Search in sources :

Example 1 with PomModelGenerator

use of org.kie.util.maven.support.PomModelGenerator in project drools by kiegroup.

the class DependentScopeNamedBeanTest method testPlexusBeanScanning.

@Test
public void testPlexusBeanScanning() {
    // This is the shortest way I can find a root to com.google.inject.internal.Scoping#makeInjectable()
    // where the @Dependent scoped bean on the classpath causes guice to fail. The below call goes through
    // the following classes:-
    // 
    // - MavenPomModelGenerator#parse()
    // - MavenProjectLoader#parseMavenPom()
    // - MavenEmbedder#constructor
    // - MavenEmbedderUtils#buildPlexusContainer()
    // 
    // This builds a PlexusContainer with classpath scanning enabled (to detect classes needing guice injection)
    final InputStream is = getClass().getResourceAsStream("/kjar/pom-kjar.xml");
    final PomModelGenerator generator = new MavenPomModelGenerator();
    try {
        final PomModel pom = generator.parse("pom.xml", is);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        fail("This should not fail");
    }
}
Also used : MavenPomModelGenerator(org.kie.maven.integration.MavenPomModelGenerator) MavenPomModelGenerator(org.kie.maven.integration.MavenPomModelGenerator) PomModelGenerator(org.kie.util.maven.support.PomModelGenerator) InputStream(java.io.InputStream) PomModel(org.kie.util.maven.support.PomModel) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)1 Test (org.junit.Test)1 MavenPomModelGenerator (org.kie.maven.integration.MavenPomModelGenerator)1 PomModel (org.kie.util.maven.support.PomModel)1 PomModelGenerator (org.kie.util.maven.support.PomModelGenerator)1