Search in sources :

Example 16 with MavenProject

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

the class InvalidProjectImportingTest method testUnresolvedPlugins.

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

Example 17 with MavenProject

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

the class MavenModuleBuilderTest method testCreatingBlank.

public void testCreatingBlank() throws Exception {
    if (!hasMavenInstallation())
        return;
    MavenId id = new MavenId("org.foo", "module", "1.0");
    createNewModule(id);
    List<MavenProject> projects = MavenProjectsManager.getInstance(myProject).getProjects();
    assertEquals(1, projects.size());
    MavenProject project = projects.get(0);
    assertEquals(id, project.getMavenId());
    assertModules("module");
    MavenProjectsManager.getInstance(myProject).isMavenizedModule(getModule("module"));
    assertSame(project, MavenProjectsManager.getInstance(myProject).findProject(getModule("module")));
    assertNotNull(myProjectRoot.findFileByRelativePath("src/main/java"));
    assertNotNull(myProjectRoot.findFileByRelativePath("src/test/java"));
    assertSources("module", "src/main/java");
    assertTestSources("module", "src/test/java");
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Example 18 with MavenProject

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

the class MavenModuleBuilderTest method testCreatingFromArchetype.

public void testCreatingFromArchetype() throws Exception {
    if (!hasMavenInstallation())
        return;
    setArchetype(new MavenArchetype("org.apache.maven.archetypes", "maven-archetype-quickstart", "1.0", null, null));
    MavenId id = new MavenId("org.foo", "module", "1.0");
    createNewModule(id);
    List<MavenProject> projects = MavenProjectsManager.getInstance(myProject).getProjects();
    assertEquals(1, projects.size());
    MavenProject project = projects.get(0);
    assertEquals(id, project.getMavenId());
    assertNotNull(myProjectRoot.findFileByRelativePath("src/main/java/org/foo/App.java"));
    assertNotNull(myProjectRoot.findFileByRelativePath("src/test/java/org/foo/AppTest.java"));
    assertSources("module", "src/main/java");
    assertTestSources("module", "src/test/java");
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) MavenProject(org.jetbrains.idea.maven.project.MavenProject) MavenArchetype(org.jetbrains.idea.maven.model.MavenArchetype)

Example 19 with MavenProject

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

the class MavenProjectTest method testMavenModelMap.

public void testMavenModelMap() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + "  <finalName>foo</finalName>" + "  <plugins>" + "    <plugin>" + "      <groupId>group1</groupId>" + "      <artifactId>id1</artifactId>" + "      <version>1</version>" + "    </plugin>" + "  </plugins>" + "</build>");
    MavenProject p = getMavenProject();
    Map<String, String> map = p.getModelMap();
    assertEquals("test", map.get("groupId"));
    assertEquals("foo", map.get("build.finalName"));
    assertEquals(new File(p.getDirectory(), "target").toString(), map.get("build.directory"));
    assertEquals(null, map.get("build.plugins"));
    assertEquals(null, map.get("build.pluginMap"));
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 20 with MavenProject

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

the class InvalidProjectImportingTest method testUnresolvedExtensionsAfterResolve.

@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedExtensionsAfterResolve() 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>");
    resolveDependenciesAndImport();
    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)

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