Je construis mes applications avec Maven-3 et je suppose qu'après l'actualisation automatique de maven-surefire-plugin à 3.0.0-M1, je ne suis pas en mesure de construire et d'obtenir l'erreur ci-dessous.
Dans un premier temps, j'ai effacé le répertoire/org/Apache/maven de mon référentiel, mais je suis toujours confronté au problème. Quelqu'un peut-il conseiller. Remarque - si je rétrograde le plugin surefire à la version 2.x, je peux le construire.
Journal des erreurs
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.444s
[INFO] Finished at: Thu Nov 08 16:04:53 GMT 2018
[INFO] Final Memory: 60M/704M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project TEST_PROJECT: Execution default-test of goal org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1': com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) No implementation for org.codehaus.plexus.languages.Java.jpms.LocationManager was bound.
[ERROR] while locating org.Apache.maven.plugin.surefire.SurefirePlugin
[ERROR] at ClassRealm[plugin>org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: Sun.misc.Launcher$AppClassLoader@5c647e05]
[ERROR] while locating org.Apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.Apache.maven.plugin.Mojo
[ERROR] roleHint: org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
[ERROR] -> [Help 1]
org.Apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project TEST_PROJECT: Execution default-test of goal org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:225)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:153)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:145)
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:320)
at org.Apache.maven.DefaultMaven.execute(DefaultMaven.Java:156)
at org.Apache.maven.cli.MavenCli.execute(MavenCli.Java:537)
at org.Apache.maven.cli.MavenCli.doMain(MavenCli.Java:196)
at org.Apache.maven.cli.MavenCli.main(MavenCli.Java:141)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
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:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.Apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.Java:115)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:209)
... 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:3.0.0-M1'
at org.Apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.Java:488)
at org.Apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.Java:92)
... 20 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for org.codehaus.plexus.languages.Java.jpms.LocationManager was bound.
while locating org.Apache.maven.plugin.surefire.SurefirePlugin
at ClassRealm[plugin>org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: Sun.misc.Launcher$AppClassLoader@5c647e05]
while locating org.Apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
1 error
role: org.Apache.maven.plugin.Mojo
roleHint: org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.Java:257)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.Java:245)
at org.Apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.Java:455)
... 21 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for org.codehaus.plexus.languages.Java.jpms.LocationManager was bound.
while locating org.Apache.maven.plugin.surefire.SurefirePlugin
at ClassRealm[plugin>org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: Sun.misc.Launcher$AppClassLoader@5c647e05]
while locating org.Apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.Apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
1 error
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.Java:974)
at com.google.inject.Scopes$1$1.get(Scopes.Java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.Java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.Java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.Java:253)
... 23 more
Vous pouvez mettre à niveau votre version de maven vers la dernière version 3.6.0 pour résoudre ce problème. Cela peut être compatible à partir de la version 3.3.9 maven.
En examinant les commentaires sur la mise à niveau de la version de maven, nous avons mis à jour notre version de maven et avons pu surmonter le problème du plugin surefire en utilisant maven 3.3.9. N'a eu aucun problème.
J'ai constaté que mon NetBeans utilisait un très vieux Maven (3.0.5), même si un nouveau Maven était installé.
Sur mon Mac, je devais aller au menu "Netbeans/Préférences", sélectionner l'onglet "Maven", et passer de "Bundled" (Navigué à la dernière page), ce qui éliminait l'erreur ci-dessus pour moi.
J'ai eu ce problème jusqu'à ce que je découvre que nous ne spécifions pas explicitement la version du plugin Surefire. Une fois que j'ai modifié notre fichier pom.xml pour définir la version, cela a fonctionné.