Search in sources :

Example 1 with MavenModel

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

the class MavenServerEmbedderTest method _testResolvingProjectWithExtensions.

public void _testResolvingProjectWithExtensions() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>com.adobe.flex.framework</groupId>" + "    <artifactId>framework</artifactId>" + "    <version>3.2.0.3958</version>" + "    <type>resource-bundle</type>" + "    <classifier>en_US</classifier>" + "  </dependency>" + "</dependencies>" + "<build>" + "  <plugins>" + "    <plugin>" + "      <groupId>org.sonatype.flexmojos</groupId>" + "      <artifactId>flexmojos-maven-plugin</artifactId>" + "      <version>3.5.0</version>" + "      <extensions>true</extensions>" + "    </plugin>" + "  </plugins>" + "</build>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
    assertNotNull(result.projectData);
    assertOrderedElementsAreEqual(result.unresolvedArtifacts);
    MavenModel p = result.projectData.mavenModel;
    assertEquals(1, p.getDependencies().size());
    assertEquals("rb.swc", p.getDependencies().get(0).getExtension());
}
Also used : MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) MavenModel(org.jetbrains.idea.maven.model.MavenModel) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole)

Example 2 with MavenModel

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

the class MavenServerEmbedderTest method _testResolvingProjectWithRegisteredExtensions.

public void _testResolvingProjectWithRegisteredExtensions() throws Exception {
    ComponentDescriptor desc = new ComponentDescriptor();
    desc.setRole(ArtifactHandler.ROLE);
    desc.setRoleHint("foo");
    desc.setImplementation(MyArtifactHandler.class.getName());
    myEmbedderImpl.getContainer().addComponentDescriptor(desc);
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>junit</groupId>" + "    <artifactId>junit</artifactId>" + "    <version>3.8.1</version>" + "    <scope>test</scope>" + "    <type>foo</type>" + "  </dependency>" + "</dependencies>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
    assertNotNull(result.projectData);
    assertOrderedElementsAreEqual(result.unresolvedArtifacts);
    MavenModel p = result.projectData.mavenModel;
    assertEquals(1, p.getDependencies().size());
    assertEquals("pom", p.getDependencies().get(0).getExtension());
}
Also used : MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) MavenModel(org.jetbrains.idea.maven.model.MavenModel) ComponentDescriptor(org.codehaus.plexus.component.repository.ComponentDescriptor) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole)

Example 3 with MavenModel

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

the class MavenServerEmbedderTest method _testResolvingProjectPropertiesInFolders.

public void _testResolvingProjectPropertiesInFolders() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
    MavenModel project = result.projectData.mavenModel;
    assertNotNull(project);
    assertEquals("project", project.getMavenId().getArtifactId());
    PlatformTestUtil.assertPathsEqual(myProjectRoot.getPath() + "/target", project.getBuild().getDirectory());
    PlatformTestUtil.assertPathsEqual(myProjectRoot.getPath() + "/src/main/java", project.getBuild().getSources().get(0));
}
Also used : MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) MavenModel(org.jetbrains.idea.maven.model.MavenModel) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole)

Example 4 with MavenModel

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

the class MavenServerEmbedderTest method _testResolvingProject.

public void _testResolvingProject() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>junit</groupId>" + "    <artifactId>junit</artifactId>" + "    <version>4.0</version>" + "  </dependency>" + "</dependencies>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
    assertNotNull(result.projectData);
    assertOrderedElementsAreEqual(result.unresolvedArtifacts);
    MavenModel project = result.projectData.mavenModel;
    assertNotNull(project);
    assertEquals("project", project.getMavenId().getArtifactId());
    assertEquals(1, project.getDependencies().size());
}
Also used : MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) MavenModel(org.jetbrains.idea.maven.model.MavenModel) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole)

Example 5 with MavenModel

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

the class MavenServerEmbedderTest method _testExecutionGoals.

public void _testExecutionGoals() throws Exception {
    createProjectSubFile("src/main/java/A.java", "public class A {}");
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    MavenServerExecutionResult result = myEmbedder.execute(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList(), Arrays.asList("compile"));
    assertNotNull(result.projectData);
    assertNotNull(new File(getProjectPath(), "target").exists());
    assertOrderedElementsAreEqual(result.unresolvedArtifacts);
    MavenModel project = result.projectData.mavenModel;
    assertNotNull(project);
    assertEquals("project", project.getMavenId().getArtifactId());
}
Also used : MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) MavenModel(org.jetbrains.idea.maven.model.MavenModel) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

SoutMavenConsole (org.jetbrains.idea.maven.execution.SoutMavenConsole)5 MavenModel (org.jetbrains.idea.maven.model.MavenModel)5 MavenServerExecutionResult (org.jetbrains.idea.maven.server.MavenServerExecutionResult)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 ComponentDescriptor (org.codehaus.plexus.component.repository.ComponentDescriptor)1