Search in sources :

Example 91 with MavenProject

use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.

the class MavenProjectNamer method allGroupsEqual.

private static boolean allGroupsEqual(Collection<MavenProject> mavenProjects) {
    Iterator<MavenProject> itr = mavenProjects.iterator();
    if (!itr.hasNext())
        return true;
    String groupId = itr.next().getMavenId().getGroupId();
    while (itr.hasNext()) {
        MavenProject mavenProject = itr.next();
        if (!Comparing.equal(groupId, mavenProject.getMavenId().getGroupId())) {
            return false;
        }
    }
    return true;
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Example 92 with MavenProject

use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.

the class ArtifactsDownloadingTest method testDownloadingSpecificDependency.

public void testDownloadingSpecificDependency() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>jmock</groupId>" + "    <artifactId>jmock</artifactId>" + "    <version>1.2.0</version>" + "  </dependency>" + "  <dependency>" + "    <groupId>junit</groupId>" + "    <artifactId>junit</artifactId>" + "    <version>4.0</version>" + "  </dependency>" + "</dependencies>");
    File sources = new File(getRepositoryPath(), "/jmock/jmock/1.2.0/jmock-1.2.0-sources.jar");
    File javadoc = new File(getRepositoryPath(), "/jmock/jmock/1.2.0/jmock-1.2.0-javadoc.jar");
    assertFalse(sources.exists());
    assertFalse(javadoc.exists());
    MavenProject project = myProjectsTree.getRootProjects().get(0);
    MavenArtifact dep = project.getDependencies().get(0);
    downloadArtifacts(Arrays.asList(project), Arrays.asList(dep));
    assertTrue(sources.exists());
    assertTrue(javadoc.exists());
    assertFalse(new File(getRepositoryPath(), "/junit/junit/4.0/junit-4.0-sources.jar").exists());
    assertFalse(new File(getRepositoryPath(), "/junit/junit/4.0/junit-4.0-javadoc.jar").exists());
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) File(java.io.File) MavenArtifact(org.jetbrains.idea.maven.model.MavenArtifact)

Example 93 with MavenProject

use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.

the class ArtifactsDownloadingTest method testReturningNotFoundArtifacts.

public void testReturningNotFoundArtifacts() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>lib</groupId>" + "    <artifactId>xxx</artifactId>" + "    <version>1</version>" + "  </dependency>" + "  <dependency>" + "    <groupId>junit</groupId>" + "    <artifactId>junit</artifactId>" + "    <version>4.0</version>" + "  </dependency>" + "</dependencies>");
    MavenProject project = myProjectsTree.getRootProjects().get(0);
    MavenArtifactDownloader.DownloadResult unresolvedArtifacts = downloadArtifacts(Arrays.asList(project), null);
    assertUnorderedElementsAreEqual(unresolvedArtifacts.resolvedSources, new MavenId("junit", "junit", "4.0"));
    assertUnorderedElementsAreEqual(unresolvedArtifacts.resolvedDocs, new MavenId("junit", "junit", "4.0"));
    assertUnorderedElementsAreEqual(unresolvedArtifacts.unresolvedSources, new MavenId("lib", "xxx", "1"));
    assertUnorderedElementsAreEqual(unresolvedArtifacts.unresolvedDocs, new MavenId("lib", "xxx", "1"));
}
Also used : MavenArtifactDownloader(org.jetbrains.idea.maven.project.MavenArtifactDownloader) MavenId(org.jetbrains.idea.maven.model.MavenId) MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Example 94 with MavenProject

use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.

the class InvalidProjectImportingTest method testUnresolvedExtensionsAfterImport.

@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedExtensionsAfterImport() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <extensions>" + "   <extension>" + "     <groupId>xxx</groupId>" + "     <artifactId>yyy</artifactId>" + "     <version>1</version>" + "    </extension>" + "  </extensions>" + "</build>");
    MavenProject root = getRootProjects().get(0);
    assertProblems(root, "Unresolved build extension: 'xxx:yyy:1'");
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) Bombed(com.intellij.idea.Bombed)

Example 95 with MavenProject

use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.

the class DependenciesImportingTest method testInterModuleDependenciesWithLatestVersionAreBeingSetupForSnapshots.

public void testInterModuleDependenciesWithLatestVersionAreBeingSetupForSnapshots() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<packaging>pom</packaging>" + "<version>1</version>" + "<modules>" + "  <module>m1</module>" + "  <module>m2</module>" + "</modules>");
    createModulePom("m1", "<groupId>test</groupId>" + "<artifactId>m1</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>test</groupId>" + "    <artifactId>m2</artifactId>" + "    <version>LATEST</version>" + "  </dependency>" + "</dependencies>");
    createModulePom("m2", "<groupId>test</groupId>" + "<artifactId>m2</artifactId>" + "<version>1-SNAPSHOT</version>");
    importProject();
    assertModules("project", "m1", "m2");
    assertModuleModuleDeps("m1", "m2");
    assertModuleLibDeps("m1");
    MavenProject p = myProjectsTree.findProject(new MavenId("test", "m1", "1"));
    assertEquals(new MavenId("test", "m2", "1-SNAPSHOT"), p.getDependencies().get(0).getMavenId());
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Aggregations

MavenProject (org.jetbrains.idea.maven.project.MavenProject)132 VirtualFile (com.intellij.openapi.vfs.VirtualFile)40 MavenProjectsManager (org.jetbrains.idea.maven.project.MavenProjectsManager)20 MavenId (org.jetbrains.idea.maven.model.MavenId)16 Project (com.intellij.openapi.project.Project)10 Nullable (org.jetbrains.annotations.Nullable)9 Bombed (com.intellij.idea.Bombed)8 Module (com.intellij.openapi.module.Module)6 DataContext (com.intellij.openapi.actionSystem.DataContext)5 File (java.io.File)5 ArrayList (java.util.ArrayList)5 Result (com.intellij.openapi.application.Result)4 MavenArtifact (org.jetbrains.idea.maven.model.MavenArtifact)4 MavenEmbeddersManager (org.jetbrains.idea.maven.project.MavenEmbeddersManager)4 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)3 TextRange (com.intellij.openapi.util.TextRange)3 NotNull (org.jetbrains.annotations.NotNull)3 MavenRunnerParameters (org.jetbrains.idea.maven.execution.MavenRunnerParameters)3 MavenExplicitProfiles (org.jetbrains.idea.maven.model.MavenExplicitProfiles)3 MavenProjectsTree (org.jetbrains.idea.maven.project.MavenProjectsTree)3