5
回答
编译插件生成的项目时出现一个异常

用的是AllInOne版本的64位eclipse,使用插件生成的项目,编译ROOT时出现一个异常。我贴出异常部分的日志,描述是plexus的interpolation路径不对。但我不清楚项目找的不是org\codehaus\plexus\plexus-interpolation而是org\codehaus\plexus\interpolation 目录。麻烦帮看看是哪里的原因,非常感谢!下面是异常日志:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar (default-jar) on project koala_demo-infra: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar failed: A required class was missing while executing org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar: org/codehaus/plexus/interpolation/InterpolationException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/d:/work/Java/Lib/Common/org/apache/maven/plugins/maven-jar-plugin/2.3.2/maven-jar-plugin-2.3.2.jar
[ERROR] urls[1] = file:/d:/work/Java/Lib/Common/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[2] = file:/d:/work/Java/Lib/Common/org/apache/maven/maven-archiver/2.4.2/maven-archiver-2.4.2.jar
[ERROR] urls[3] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-archiver/2.0.1/plexus-archiver-2.0.1.jar
[ERROR] urls[4] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-io/2.0.1/plexus-io-2.0.1.jar
[ERROR] urls[5] = file:/d:/work/Java/Lib/Common/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
[ERROR] urls[6] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.codehaus.plexus.interpolation.InterpolationException
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar (default-jar) on project koala_demo-infra: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar failed: A required class was missing while executing org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar: org/codehaus/plexus/interpolation/InterpolationException
-----------------------------------------------------
realm = plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.2
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/d:/work/Java/Lib/Common/org/apache/maven/plugins/maven-jar-plugin/2.3.2/maven-jar-plugin-2.3.2.jar
urls[1] = file:/d:/work/Java/Lib/Common/junit/junit/3.8.1/junit-3.8.1.jar
urls[2] = file:/d:/work/Java/Lib/Common/org/apache/maven/maven-archiver/2.4.2/maven-archiver-2.4.2.jar
urls[3] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-archiver/2.0.1/plexus-archiver-2.0.1.jar
urls[4] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-io/2.0.1/plexus-io-2.0.1.jar
urls[5] = file:/d:/work/Java/Lib/Common/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
urls[6] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------
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: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-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar failed: A required class was missing while executing org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar: org/codehaus/plexus/interpolation/InterpolationException
-----------------------------------------------------
realm = plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.2
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/d:/work/Java/Lib/Common/org/apache/maven/plugins/maven-jar-plugin/2.3.2/maven-jar-plugin-2.3.2.jar
urls[1] = file:/d:/work/Java/Lib/Common/junit/junit/3.8.1/junit-3.8.1.jar
urls[2] = file:/d:/work/Java/Lib/Common/org/apache/maven/maven-archiver/2.4.2/maven-archiver-2.4.2.jar
urls[3] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-archiver/2.0.1/plexus-archiver-2.0.1.jar
urls[4] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-io/2.0.1/plexus-io-2.0.1.jar
urls[5] = file:/d:/work/Java/Lib/Common/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
urls[6] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.plugin.PluginContainerException: A required class was missing while executing org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar: org/codehaus/plexus/interpolation/InterpolationException
-----------------------------------------------------
realm = plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.2
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/d:/work/Java/Lib/Common/org/apache/maven/plugins/maven-jar-plugin/2.3.2/maven-jar-plugin-2.3.2.jar
urls[1] = file:/d:/work/Java/Lib/Common/junit/junit/3.8.1/junit-3.8.1.jar
urls[2] = file:/d:/work/Java/Lib/Common/org/apache/maven/maven-archiver/2.4.2/maven-archiver-2.4.2.jar
urls[3] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-archiver/2.0.1/plexus-archiver-2.0.1.jar
urls[4] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-io/2.0.1/plexus-io-2.0.1.jar
urls[5] = file:/d:/work/Java/Lib/Common/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
urls[6] = file:/d:/work/Java/Lib/Common/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:125)
... 20 more
Caused by: java.lang.NoClassDefFoundError: org/codehaus/plexus/interpolation/InterpolationException
at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:188)
at org.apache.maven.plugin.jar.AbstractJarMojo.execute(AbstractJarMojo.java:235)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.interpolation.InterpolationException
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)
... 23 more
[ERROR] 
[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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :koala_demo-infra

举报
pyfhua
发帖于4年前 5回/10K+阅
jre配置不对 在eclipse中把jre改为jdk中改的jre就可以了
--- 共有 4 条评论 ---
黄超@郝杰 我也遇到这个问题了 4年前 回复
黄超@郝杰 请问这个问题解决了吗? 4年前 回复
pyfhua回复 @郝杰 : 后来我找到了原因是MAVEN使用的私服有缓存,而缓存里的包是旧的不是新的,最后直接修改M2E不试用私服而是直接连外网,最后就好了。如果你的情况和我类似可以试试这样能否解决。 4年前 回复
郝杰我也遇到了类似的问题,改了也没有效果,我的错误是 [ERROR] Number of foreign imports: 1 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]] [ERROR] ----: org.codehaus.plexus.util.StringUtils 4年前 回复
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.codehaus.plexus.interpolation.InterpolationException

[ERROR] -> [Help 1]

去maven本地库中把org.codehaus.plexus.interpolation.InterpolationException这个类中对应的jar删掉再重新打包试试

1、使用-e参数,打印出错原因。如:mvn install -e 
2、根据错误提示,如 
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/shared/incremental/IncrementalBuildHelper 
去maven库路径里找对应的jar包,看看怎么回事,发现这个文件: 
D:\maven\repository\org\apache\maven\shared\maven-shared-incremental\1.1\maven-shared-incremental-1.1.jar 

它的大小是0KB,是个空jar包,说明它下载的时候出错了,没有下载成。 
删除掉它,让它重新下载。 

顶部