Search in sources :

Example 1 with SoutMavenConsole

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

the class MavenServerEmbedderTest method _testUnresolvedArtifacts.

public void _testUnresolvedArtifacts() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>fff</groupId>" + "    <artifactId>zzz</artifactId>" + "    <version>666</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, new MavenId("fff", "zzz", "666"));
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole)

Example 2 with SoutMavenConsole

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

the class MavenServerEmbedderTest method _testUnresolvedSystemArtifactsWithoutPath.

public void _testUnresolvedSystemArtifactsWithoutPath() throws Exception {
    // need to repair model before resolving
    if (ignore())
        return;
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>fff</groupId>" + "    <artifactId>zzz</artifactId>" + "    <version>666</version>" + "    <scope>system</scope>" + "  </dependency>" + "</dependencies>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    MavenServerExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
    assertNotNull(result);
    assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole)

Example 3 with SoutMavenConsole

use of org.jetbrains.idea.maven.execution.SoutMavenConsole 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 4 with SoutMavenConsole

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

the class MavenServerEmbedderTest method _testDependencyWithUnresolvedParent.

public void _testDependencyWithUnresolvedParent() throws Exception {
    File repo = new File(myDir, "/repo");
    setRepositoryPath(repo.getPath());
    initEmbedder();
    VirtualFile m = createModulePom("foo-parent", "<groupId>test</groupId>" + "<artifactId>foo-parent</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    myEmbedder.execute(m, Collections.<String>emptyList(), Collections.<String>emptyList(), Arrays.asList("install"));
    myEmbedder.reset();
    File fooParentFile = new File(repo, "test/foo-parent/1/foo-parent-1.pom");
    assertTrue(fooParentFile.exists());
    m = createModulePom("foo", "<artifactId>foo</artifactId>" + "<version>1</version>" + "<parent>" + "  <groupId>test</groupId>" + "  <artifactId>foo-parent</artifactId>" + "  <version>1</version>" + "</parent>");
    myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
    myEmbedder.execute(m, Collections.<String>emptyList(), Collections.<String>emptyList(), Arrays.asList("install"));
    myEmbedder.reset();
    assertTrue(new File(repo, "test/foo/1/foo-1.pom").exists());
    FileUtil.delete(fooParentFile);
    // reset all caches
    initEmbedder();
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>test</groupId>" + "    <artifactId>foo</artifactId>" + "    <version>1</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, new MavenId("test", "foo-parent", "1"));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) MavenId(org.jetbrains.idea.maven.model.MavenId) MavenServerExecutionResult(org.jetbrains.idea.maven.server.MavenServerExecutionResult) SoutMavenConsole(org.jetbrains.idea.maven.execution.SoutMavenConsole) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 5 with SoutMavenConsole

use of org.jetbrains.idea.maven.execution.SoutMavenConsole 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)

Aggregations

SoutMavenConsole (org.jetbrains.idea.maven.execution.SoutMavenConsole)11 MavenServerExecutionResult (org.jetbrains.idea.maven.server.MavenServerExecutionResult)9 MavenModel (org.jetbrains.idea.maven.model.MavenModel)5 MavenId (org.jetbrains.idea.maven.model.MavenId)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 File (java.io.File)3 Notification (com.intellij.notification.Notification)2 CommonBundle (com.intellij.CommonBundle)1 NotificationType (com.intellij.notification.NotificationType)1 Notifications (com.intellij.notification.Notifications)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 WriteAction (com.intellij.openapi.application.WriteAction)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Task (com.intellij.openapi.progress.Task)1 Project (com.intellij.openapi.project.Project)1 JavadocOrderRootType (com.intellij.openapi.roots.JavadocOrderRootType)1 OrderRootType (com.intellij.openapi.roots.OrderRootType)1 NewLibraryConfiguration (com.intellij.openapi.roots.libraries.NewLibraryConfiguration)1 OrderRoot (com.intellij.openapi.roots.libraries.ui.OrderRoot)1