用m2e遇到的小问题

发布于 2021-12-08 07:11:32 字数 8509 浏览 803 评论 7

每次创建工程,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 SettingsAdministratorworkspacebsrcmainresources

[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还打不开.....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

冷默言语 2021-12-10 04:03:20

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

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

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

谢绝鈎搭 2021-12-10 04:03:09

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

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

不乱于心 2021-12-10 04:03:09

可以尝试用一下gradle

苍暮颜 2021-12-10 04:03:07

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

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

一人独醉 2021-12-10 02:01:21

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

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

剑心龙吟 2021-12-10 01:46:23

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

缺少 plexus 这个 jar 包吧

醉生梦死 2021-12-09 18:43:39

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

缺少 plexus 这个 jar 包吧

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文