Search in sources :

Example 96 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 97 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)

Example 98 with MavenProject

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

the class DependenciesImportingTest method testPropertyInTheManagedModuleDependencyVersionOfPomType.

public void testPropertyInTheManagedModuleDependencyVersionOfPomType() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<properties>" + "  <version>1</version>" + "</properties>" + "<dependencyManagement>" + "  <dependencies>" + "    <dependency>" + "      <groupId>xxx</groupId>" + "      <artifactId>yyy</artifactId>" + "      <version>${version}</version>" + "      <type>pom</type>" + "    </dependency>" + "  </dependencies>" + "</dependencyManagement>" + "<modules>" + "  <module>m</module>" + "</modules>");
    createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<parent>" + "  <groupId>test</groupId>" + "  <artifactId>project</artifactId>" + "  <version>1</version>" + "</parent>" + "<dependencies>" + "  <dependency>" + "    <groupId>xxx</groupId>" + "    <artifactId>yyy</artifactId>" + "    <type>pom</type>" + "  </dependency>" + "</dependencies>");
    importProject();
    assertModules("project", "m");
    assertModuleLibDeps("m");
    if (ignore())
        return;
    MavenProject root = myProjectsTree.getRootProjects().get(0);
    List<MavenProject> modules = myProjectsTree.getModules(root);
    assertOrderedElementsAreEqual(root.getProblems());
    assertOrderedElementsAreEqual(modules.get(0).getProblems(), "Unresolved dependency: xxx:yyy:pom:1:compile");
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Example 99 with MavenProject

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

the class InvalidProjectImportingTest method testDoesNotReportInterModuleDependenciesAsUnresolved.

public void testDoesNotReportInterModuleDependenciesAsUnresolved() 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>1</version>" + "  </dependency>" + "</dependencies>");
    createModulePom("m2", "<groupId>test</groupId>" + "<artifactId>m2</artifactId>" + "<version>1</version>");
    importProject();
    MavenProject root = getRootProjects().get(0);
    assertProblems(root);
    assertProblems(getModules(root).get(0));
    assertProblems(getModules(root).get(1));
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Example 100 with MavenProject

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

the class InvalidProjectImportingTest method testMissingModules.

public void testMissingModules() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + "  <module>foo</module>" + "</modules>");
    assertModules("project");
    MavenProject root = getRootProjects().get(0);
    assertProblems(root, "Module 'foo' not found");
}
Also used : 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