用m2e遇到的小问题

Genus 发布于 2012/02/09 08:34
阅读 7K+
收藏 0

每次创建工程,build或者test的时候都会出现这个问题。

[INFO] Scanning for projects...

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building b 0.0.1-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO] 

[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ b ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] skip non existing resourceDirectory C:\Documents and Settings\Administrator\workspace\b\src\main\resources

[INFO] 

[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ b ---

0 [main] ERROR org.sonatype.guice.bean.reflect.LoadedClass - Error injecting: org.apache.maven.plugin.CompilerMojo

java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/CompilerException

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)

at java.lang.Class.getDeclaredConstructors(Unknown Source)

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: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(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

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.compiler.CompilerException

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)

... 47 more

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 0.875s

[INFO] Finished at: Thu Feb 09 08:32:49 CST 2012

[INFO] Final Memory: 3M/15M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project b: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile failed: Unable to load the mojo 'compile' in the plugin 'org.apache.maven.plugins:maven-compiler-plugin:2.3.2'. A required class is missing: org/codehaus/plexus/compiler/CompilerException

[ERROR] -----------------------------------------------------

[ERROR] realm =    plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.2

[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

[ERROR] urls[0] = file:/C:/Documents%20and%20Settings/Administrator/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar

[ERROR] urls[1] = file:/C:/Documents%20and%20Settings/Administrator/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar

[ERROR] urls[2] = file:/C:/Documents%20and%20Settings/Administrator/.m2/repository/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.jar

[ERROR] urls[3] = file:/C:/Documents%20and%20Settings/Administrator/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.jar

[ERROR] urls[4] = file:/C:/Documents%20and%20Settings/Administrator/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar

[ERROR] Number of foreign imports: 1

[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

[ERROR] 

[ERROR] -----------------------------------------------------: org.codehaus.plexus.compiler.CompilerException

[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

该怎么解决,最下面的那个wiki还打不开.....

加载中
0
鉴客
鉴客

java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/CompilerException

缺少 plexus 这个 jar 包吧

0
Genus
Genus

引用来自“鉴客”的答案

java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/CompilerException

缺少 plexus 这个 jar 包吧

那得怎么解决。。。一般不都是maven自动管理的吗。。。
0
cwledit
cwledit

首先在cmd里用mvn创建和测试时是否有这个问题.

如果在cmd中美问题的话,查看下eclipse的首选项maven中选择正确的机器上安装的maven

0
Genus
Genus

引用来自“cwledit”的答案

首先在cmd里用mvn创建和测试时是否有这个问题.

如果在cmd中美问题的话,查看下eclipse的首选项maven中选择正确的机器上安装的maven

我把maven重新安装配置了一次,问题莫名其妙的消失了。。。。
0
Genus
Genus

引用来自“杨辰”的答案

引用来自“cwledit”的答案

首先在cmd里用mvn创建和测试时是否有这个问题.

如果在cmd中美问题的话,查看下eclipse的首选项maven中选择正确的机器上安装的maven

我把maven重新安装配置了一次,问题莫名其妙的消失了。。。。
重新安装eclipse和maven插件建立项目和打包还是会出现这个问题,在linux上九没有这些问题,一到windows上就不行。。。。郁闷。
0
lion_yang
lion_yang
可以尝试用一下gradle
0
郝少
郝少

我的也没解决。给大家推荐个中国谷歌搜索站 http://www.woaigoogle.com   ,不用翻墙直接搜就行。

0
扎克扎克
扎克扎克

这个帖子好像年代很久远了啊 ,不过最近也遇到这个问题,现在解决了,贴下自己的解决方法,希望对其他人有帮助。

原因:一般可能是下载的jar文件损坏了。为了验证这个问题,可以尝试去打开这个jar,看class文件是否可以打开。

解决方法:在maven仓库中找到这个jar所在文件夹,完全删除,然后重新尝试。如果工程依赖这个jar,那么会重新下载。然后问题就消失了。

返回顶部
顶部