Eclipse的不同行为

时间:2012-06-14 14:48:52

标签: eclipse maven maven-3

目前我正在开发一个包含一些子项目的构建脚本。问题是使用eclipse构建总是失败。在这句话下面你可以看到Eclipse的注销:

[INFO] Reactor Summary:
[INFO] 
[INFO] CQ5 deployment Plugin ............................. SUCCESS [2.031s]
[INFO] Set up enviroment ................................. SUCCESS [0.000s]
[INFO] Hotfix packages for Communiqué .................... SUCCESS [0.406s]
[INFO] Archiva servlet ................................... SUCCESS [0.375s]
[INFO] Ldap Client ....................................... SUCCESS [0.422s]
[INFO] Hibernate ......................................... SUCCESS [7.719s]
[INFO] Main .............................................. SUCCESS [0.015s]
[INFO] Base .............................................. SUCCESS [0.000s]
[INFO] Core .............................................. FAILURE [1.578s]
[INFO] UI ................................................ SKIPPED
[INFO] Commons ........................................... SKIPPED
[INFO] Core .............................................. SKIPPED
[INFO] UI ................................................ SKIPPED
[INFO] Internet .......................................... SKIPPED
[INFO] Core .............................................. SKIPPED
[INFO] UI ................................................ SKIPPED
[INFO] Infothek .......................................... SKIPPED
[INFO] Core .............................................. SKIPPED
[INFO] UI ................................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.390s
[INFO] Finished at: Thu Jun 14 16:37:31 CEST 2012
[INFO] Final Memory: 17M/59M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.2:scr (generate-scr-scrdescriptor) on project core: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.7.2:scr failed: An API incompatibility was encountered while executing org.apache.felix:maven-scr-plugin:1.7.2:scr: java.lang.UnsupportedClassVersionError: Bad version number in .class file
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.felix:maven-scr-plugin:1.7.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/org/apache/felix/maven-scr-plugin/1.7.2/maven-scr-plugin-1.7.2.jar
[ERROR] urls[1] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar
[ERROR] urls[2] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
[ERROR] urls[3] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[4] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar
[ERROR] urls[5] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/org/apache/felix/org.apache.felix.scr.generator/1.1.2/org.apache.felix.scr.generator-1.1.2.jar
[ERROR] urls[6] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.jar
[ERROR] urls[7] = file:/c:/Dokumente%20und%20Einstellungen/reporter/.m2/repository/asm/asm-all/3.1/asm-all-3.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[project>de.xxx.cq5.ldap:Ldap:1.0.0, parent: ClassRealm[maven.api, parent: null]]]
[ERROR] 
[ERROR] -----------------------------------------------------
[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

如果我在dos提示符下运行构建脚本,它将以成功的结果运行。

我正在使用Eclipse 3.7.1(Indigeo)。我确保所有子项目都连接到相同的Java版本。即使清理工作区并运行mvn clean也无济于事。 我真的被困了,所以我希望有人可以帮助我吗?

此致

2 个答案:

答案 0 :(得分:0)

我假设您使用m2eclipse。如果是这样,也许您使用嵌入式Maven实例(请参阅m2eclipse首选项),这是您在Eclipse之外使用的Maven实例的另一个版本吗?

答案 1 :(得分:0)

外部顾问向我展示了解决方案。

解决方案: 标记目标项目并选择“属性”。然后选择“Java Build Path”,然后选择“Libraries”选项卡。在那里我可以看到Eclipse使用了JRE 1.5.0_12。我选择它并按下“Edit”按钮,所以另一个menue确实发生了。有三个单选按钮('执行环境','备用JRE'和'工作区默认JRE(jdk1.6.0_16)'。默认是第一个启用选项。启用第三个选项后,我的问题已经消失。

外部顾问认为这是Eclipse安装时间点的问题。然后将上面的jre 1.5定义为默认运行时环境。显然,Eclipse将其视为“默认”版本。很奇怪......

相关问题