Search in sources :

Example 1 with ComponentDescriptor

use of org.codehaus.plexus.component.repository.ComponentDescriptor in project intellij-community by JetBrains.

the class MavenEmbedder method setImplementation.

public static <T> void setImplementation(PlexusContainer container, Class<T> componentClass, Class<? extends T> implementationClass) {
    ComponentDescriptor d = container.getComponentDescriptor(componentClass.getName());
    d.setImplementation(implementationClass.getName());
}
Also used : ComponentDescriptor(org.codehaus.plexus.component.repository.ComponentDescriptor)

Example 2 with ComponentDescriptor

use of org.codehaus.plexus.component.repository.ComponentDescriptor 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

ComponentDescriptor (org.codehaus.plexus.component.repository.ComponentDescriptor)2 SoutMavenConsole (org.jetbrains.idea.maven.execution.SoutMavenConsole)1 MavenModel (org.jetbrains.idea.maven.model.MavenModel)1 MavenServerExecutionResult (org.jetbrains.idea.maven.server.MavenServerExecutionResult)1