Search in sources :

Example 41 with MavenId

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

the class MavenModuleBuilderTest method testAddingNewlyCreatedModuleToTheAggregator.

public void testAddingNewlyCreatedModuleToTheAggregator() throws Exception {
    if (!hasMavenInstallation())
        return;
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    setModuleNameAndRoot("module", getProjectPath() + "/module");
    setAggregatorProject(myProjectPom);
    createNewModule(new MavenId("org.foo", "module", "1.0"));
    assertEquals(createPomXml("<groupId>test</groupId>" + "<artifactId>project</artifactId>\n" + "    <packaging>pom</packaging>\n" + "    <version>1</version>\n" + "    <modules>\n" + "        <module>module</module>\n" + "    </modules>\n"), StringUtil.convertLineSeparators(VfsUtil.loadText(myProjectPom)));
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId)

Example 42 with MavenId

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

the class MavenModuleBuilderTest method testAddingParentWithInheritedProperties.

public void testAddingParentWithInheritedProperties() throws Exception {
    if (!hasMavenInstallation())
        return;
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    setModuleNameAndRoot("module", getProjectPath() + "/module");
    setParentProject(myProjectPom);
    setInheritedOptions(true, true);
    createNewModule(new MavenId("org.foo", "module", "1.0"));
    assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" + "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" + "    <parent>\n" + "        <artifactId>project</artifactId>\n" + "        <groupId>test</groupId>\n" + "        <version>1</version>\n" + "    </parent>\n" + "    <modelVersion>4.0.0</modelVersion>\n" + "\n" + "    <artifactId>module</artifactId>\n" + "\n" + "\n" + "</project>", VfsUtil.loadText(myProjectRoot.findFileByRelativePath("module/pom.xml")));
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId)

Example 43 with MavenId

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

the class MavenModuleBuilderTest method testInheritJdkFromProject.

public void testInheritJdkFromProject() throws Exception {
    if (!hasMavenInstallation())
        return;
    createNewModule(new MavenId("org.foo", "module", "1.0"));
    ModuleRootManager manager = ModuleRootManager.getInstance(getModule("module"));
    assertTrue(manager.isSdkInherited());
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager)

Example 44 with MavenId

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

the class MavenModuleBuilderTest method testAddingManagedProjectIfNoArrgerator.

public void testAddingManagedProjectIfNoArrgerator() throws Exception {
    if (!hasMavenInstallation())
        return;
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    assertEquals(1, myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths().size());
    setModuleNameAndRoot("module", getProjectPath() + "/module");
    setAggregatorProject(null);
    createNewModule(new MavenId("org.foo", "module", "1.0"));
    myProjectRoot.findFileByRelativePath("module/pom.xml");
    assertEquals(2, myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths().size());
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId)

Example 45 with MavenId

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

the class MavenModuleBuilderTest method testAddingParent.

public void testAddingParent() throws Exception {
    if (!hasMavenInstallation())
        return;
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    setModuleNameAndRoot("module", getProjectPath() + "/module");
    setParentProject(myProjectPom);
    createNewModule(new MavenId("org.foo", "module", "1.0"));
    assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" + "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" + "    <parent>\n" + "        <artifactId>project</artifactId>\n" + "        <groupId>test</groupId>\n" + "        <version>1</version>\n" + "    </parent>\n" + "    <modelVersion>4.0.0</modelVersion>\n" + "\n" + "    <groupId>org.foo</groupId>\n" + "    <artifactId>module</artifactId>\n" + "    <version>1.0</version>\n" + "\n" + "\n" + "</project>", VfsUtil.loadText(myProjectRoot.findFileByRelativePath("module/pom.xml")));
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId)

Aggregations

MavenId (org.jetbrains.idea.maven.model.MavenId)59 MavenProject (org.jetbrains.idea.maven.project.MavenProject)16 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 Module (com.intellij.openapi.module.Module)5 NotNull (org.jetbrains.annotations.NotNull)5 Nullable (org.jetbrains.annotations.Nullable)5 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)4 IOException (java.io.IOException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 RemoteException (java.rmi.RemoteException)4 ArchetypeDataSourceException (org.apache.maven.archetype.source.ArchetypeDataSourceException)4 SoutMavenConsole (org.jetbrains.idea.maven.execution.SoutMavenConsole)4 MavenArtifact (org.jetbrains.idea.maven.model.MavenArtifact)4 MavenServerExecutionResult (org.jetbrains.idea.maven.server.MavenServerExecutionResult)4 Project (com.intellij.openapi.project.Project)3 File (java.io.File)3 MavenArchetype (org.jetbrains.idea.maven.model.MavenArchetype)3 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)2 Result (com.intellij.openapi.application.Result)2 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)2