错误org.sonatype.guice.bean.reflect.NamedClass - 注入错误:org.codehaus.plexus.archiver.jar.JarArchiver

时间:2012-08-01 04:30:56

标签: maven

我有maven项目,所以我尝试maven安装制作jar。 但我因为java.lang.ClassNotFoundException而被骗了。 所以,我找到了包含该类的jar。我在pom.xml中添加了dependecny。

<dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-io</artifactId>
      <version>1.0</version>
</dependency>

尽管如此,它也犯了同样的错误。

最奇怪的是我在另一台具有相同功能的计算机上正常运行它 开发环境,窗口的位数除外。

我发现的错误如下所示。

0 [main] ERROR org.sonatype.guice.bean.reflect.NamedClass - Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver
java.lang.NoClassDefFoundError: org/codehaus/plexus/components/io/resources/PlexusIoResourceCollection
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getDeclaredConstructors(Class.java:1836)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:609)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:816)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:750)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:235)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:185)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:824)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:938)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:971)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:932)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
    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:949)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
    at org.sonatype.guice.plexus.binders.PlexusRequirements$RequirementProvider.get(PlexusRequirements.java:222)
    at org.sonatype.guice.plexus.binders.ProvidedPropertyBinding.injectProperty(ProvidedPropertyBinding.java:50)
    at org.sonatype.guice.bean.inject.BeanInjector.doInjection(BeanInjector.java:101)
    at org.sonatype.guice.bean.inject.BeanInjector.injectMembers(BeanInjector.java:66)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:120)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:94)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:253)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
    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:949)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    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:247)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:451)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:98)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    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:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    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: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: java.lang.ClassNotFoundException: org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 66 more
5 [main] ERROR org.sonatype.guice.bean.reflect.LoadedClass - Error injecting: org.apache.maven.plugin.jar.JarMojo
com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver
  at ClassRealm[plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@addbf1]
  while locating org.codehaus.plexus.archiver.Archiver annotated with @com.google.inject.name.Named(value=jar)
  while locating org.apache.maven.plugin.jar.JarMojo

1 error
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:958)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
    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:949)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    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:247)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:451)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:98)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    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:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    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: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: java.lang.NoClassDefFoundError: org/codehaus/plexus/components/io/resources/PlexusIoResourceCollection
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getDeclaredConstructors(Class.java:1836)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:609)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:816)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:750)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:235)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:185)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:824)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:938)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:971)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:932)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
    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:949)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
    at org.sonatype.guice.plexus.binders.PlexusRequirements$RequirementProvider.get(PlexusRequirements.java:222)
    at org.sonatype.guice.plexus.binders.ProvidedPropertyBinding.injectProperty(ProvidedPropertyBinding.java:50)
    at org.sonatype.guice.bean.inject.BeanInjector.doInjection(BeanInjector.java:101)
    at org.sonatype.guice.bean.inject.BeanInjector.injectMembers(BeanInjector.java:66)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:120)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:94)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:253)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
    ... 33 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 66 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.228s
[INFO] Finished at: Wed Aug 01 11:07:17 KST 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project javaperf_io_ReadFile: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar failed: Unable to load the mojo 'jar' in the plugin 'org.apache.maven.plugins:maven-jar-plugin:2.3.1'. A required class is missing: org/codehaus/plexus/components/io/resources/PlexusIoResourceCollection
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/maven/repository/org/apache/maven/plugins/maven-jar-plugin/2.3.1/maven-jar-plugin-2.3.1.jar
[ERROR] urls[1] = file:/C:/maven/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[2] = file:/C:/maven/repository/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.jar
[ERROR] urls[3] = file:/C:/maven/repository/org/codehaus/plexus/plexus-archiver/1.0/plexus-archiver-1.0.jar
[ERROR] urls[4] = file:/C:/maven/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
[ERROR] urls[5] = file:/C:/maven/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

0 个答案:

没有答案