On 28 October 2010 23:20, Martin Gainty <mgai...@hotmail.com> wrote:

>
> Folks
>
> 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
>

some comments:

1)  there is no Guice code in the surefire plugin, it's all hidden behind a
Plexus facade that's part of the Maven distributable
     - so if it works with one version of surefire, but not another, and
with the same level of Maven then it's not necessarily a
     problem with the injector since the same injection code is running in
both cases

2)  the role-hint is computed by Maven and used to distinguish between mojos
- neither Plexus or Guice assign any meaning
     to the structure of a role-hint, it's just an opaque string to the
injection system - that said, the role-hint is expected to have
     the goal name as the suffix, otherwise Maven can't distinguish between
different mojos in the same plugin

3)  if you do open an issue on JIRA please attach a test project or
recreation instructions - I've done several builds involving
     surefire with Maven 3 and not seen this error, so I get the feeling it
might be hard to reproduce this issue from scratch

will file a jira
>
> thanks,
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
>
>
> From: mgai...@hotmail.com
> To: users@maven.apache.org
> Subject: Guice Injector appears to be version-unaware
> Date: Tue, 26 Oct 2010 11:12:12 -0400
>
>
>
>
> Ive noticed recent introduction of Guice injector seemd to be
> version-unaware of the requested plugin
> Is there any way I can request Guice injector to inject a specific version
> of plugin (instead of the first version of the plugin the Guice injector
> sees)
> ?
> Vielen Danke/Bedankt/Merci
> Martin
> ______________________________________________
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
> Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
>
> Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
> nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
> alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
> megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
> tartalma miatt.
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>



-- 
Cheers, Stuart

Reply via email to