massive grief by DefaultPlexusContainer lookup which incorrectly parsed the 
roleHint
------------------------------------------------------------------------------------

                 Key: SUREFIRE-655
                 URL: http://jira.codehaus.org/browse/SUREFIRE-655
             Project: Maven Surefire
          Issue Type: Bug
    Affects Versions: 2.5
         Environment: >mvn -version
Apache Maven 3.0 (r1004208; 2010-10-04 13:50:56+0200)
Java version: 1.6.0_16
Java home: C:\Java\jdk\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
            Reporter: Martin Gainty


originally i was using 2.5 version of maven-surefire-plugin as seen here

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>

this caused massive grief by DefaultPlexusContainer lookup which incorrectly 
parsed the roleHint

so i backed all my dependencies of maven-surefire-plugin down to v 2.4.2 to rid 
myself of the guice injector anomaly here is the debug error listing:
note that the org.codehaus.plexus.DefaultPlexusContainer roleHint is 
incorrectly assigned  org.apache.maven.plugins:maven-surefire-plugin:2.5:test 

it should be                                                                    
        org.apache.maven.plugins:maven-surefire-plugin:2.5

for the lookup to work


[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.apache.maven.plugins:maven-surefire-plugin:2.5:test: 
Guice provision errors:
[ERROR] 
[ERROR] 1) No implementation for 
org.apache.maven.artifact.resolver.ArtifactResolver was bound.
[ERROR] while locating org.apache.maven.plugin.surefire.SurefirePlugin
[ERROR] 
[ERROR] 1 error
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.5:test (default-test) on 
project maven-checkstyle-plugin: Execution default-test of goal 
org.apache.maven.plugins:maven-surefire-plugin:2.5:test failed: Unable to load 
the mojo 'test' (or one of its required components) from the plugin 
'org.apache.maven.plugins:maven-surefire-plugin:2.5'
 at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
 at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
 at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
 at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
 at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
 at 
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
 at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
 at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution 
default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test 
failed: Unable to load the mojo 'test' (or one of its required components) from 
the plugin 'org.apache.maven.plugins:maven-surefire-plugin:2.5'
 at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
 at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
 ... 19 more
Caused by: org.apache.maven.plugin.PluginContainerException: Unable to load the 
mojo 'test' (or one of its required components) from the plugin 
'org.apache.maven.plugins:maven-surefire-plugin:2.5'
 at 
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:426)
 at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:96)
 ... 20 more
Caused by: 
org.codehaus.plexus.component.repository.exception.ComponentLookupException: 
com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin
  at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:2.5, 
parent: ClassRealm[maven.api, parent: null]]
  while locating org.apache.maven.plugin.Mojo annotated with 
@com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:2.5:test)

1 error
      role: org.apache.maven.plugin.Mojo
  roleHint: org.apache.maven.plugins:maven-surefire-plugin:2.5:test
 at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
 at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:241)
 at 
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:393)
 ... 21 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin
  at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:2.5, 
parent: ClassRealm[maven.api, parent: null]]
  while locating org.apache.maven.plugin.Mojo annotated with 
@com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:2.5:test)

1 error
 at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:957)
 at com.google.inject.Scopes$1$1.get(Scopes.java:63)
 at 
org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
 at 
org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
 at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:249)
 ... 23 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.apache.maven.artifact.resolver.ArtifactResolver 
was bound.
  while locating org.apache.maven.plugin.surefire.SurefirePlugin

1 error
 at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:957)
 at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:983)
 at 
org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
 at 
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
 at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:948)
 at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:994)
 at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:944)
 ... 27 more

/* the correct implementation is as follows */
  <build>
   <plugins>
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.4.2</version>
            <inherited>false</inherited>
            <configuration>
              <childDelegation>true</childDelegation>
              <useManifestOnlyJar>true</useManifestOnlyJar>
              <useSystemClassLoader>true</useSystemClassLoader>
              <skipTests>true</skipTests>
              <forkMode>never</forkMode>
              <useFile>true</useFile>
              <trimStackTrace>false</trimStackTrace>
              <failIfNoTests>false</failIfNoTests>
              <systemProperties combine.children="append">
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              
<classesDirectory>${project.build.directory}/target/test-classes</classesDirectory>
           <property>
                         <!-- Pass this through to the tests (if set!) to have 
them pick the right repository -->
                         <name>maven.repo.local</name>
                         
<value>file://C:/DOCUME~1/NotBillGates/.m2/repository</value>
           </property>
       </systemProperties>
            </configuration>
    </plugin>
  </plugins>
 </build>


I think this is perhaps what ken was alluding to about maven when bugs are 
discovered
my suggestion is we clear the Guice Injector code out of maven-surefire-plugin 
until we can determine DefaultPlexusContainer can correctly parse the artifact 
string from

org.apache.maven.plugins:maven-surefire-plugin:2.5:test:

to

org.apache.maven.plugins:maven-surefire-plugin:2.5

Thanks,
Martin

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to