Maven构建多模块项目成功,Eclipse报错
Maven builds multi module project succesfully, Eclipse shows errors
注意:此题与this one类似,但那里的答案对我不起作用。
我有一个奇怪的问题:在命令行中使用Maven,我的构建是成功的,但是在Eclipse 中导入它仍然显示错误。特别是,我正在尝试构建开源 rosetta-dsl 项目,这是一个包含 Xtext 和 Xtend 文件的多模块 Maven 项目。
运行 mvn clean install
结果如下:
[INFO] Reactor Summary for com.regnosys.rosetta.parent 0.0.0.master:
[INFO]
[INFO] com.regnosys.rosetta.parent ........................ SUCCESS [ 0.282 s]
[INFO] com.regnosys.rosetta.lib ........................... SUCCESS [ 17.832 s]
[INFO] com.regnosys.rosetta ............................... SUCCESS [02:22 min]
[INFO] com.regnosys.rosetta.target ........................ SUCCESS [ 0.114 s]
[INFO] com.regnosys.rosetta.blueprints .................... SUCCESS [ 1.168 s]
[INFO] com.regnosys.rosetta.tests ......................... SUCCESS [ 40.176 s]
[INFO] com.regnosys.rosetta.ide ........................... SUCCESS [ 3.613 s]
[INFO] com.regnosys.rosetta.ui ............................ SUCCESS [ 3.721 s]
[INFO] com.regnosys.rosetta.ui.tests ...................... SUCCESS [ 21.185 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:08 min
[INFO] Finished at: 2021-08-06T14:59:53+02:00
[INFO] ------------------------------------------------------------------------
Eclipse 显示 40 个错误,包括:
Bundle 'net.bytebuddy.byte-buddy' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.lib/META-INF line 16 Plug-in Problem
Bundle 'org.apache.commons.lang3' cannot be resolved MANIFEST.MF /com.regnosys.rosetta/META-INF line 24 Plug-in Problem
Bundle 'org.mockito' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.lib/META-INF line 15 Plug-in Problem
Bundle 'org.mockito' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.tests/META-INF line 20 Plug-in Problem
Bundle 'org.objenesis' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.lib/META-INF line 17 Plug-in Problem
Bundle org.apache.commons.lang3 cannot be resolved build.properties /com.regnosys.rosetta line 21 Plug-in Problem
org.mockito.Mockito cannot be resolved to a type. DocReferenceTest.xtend /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/docrefs line: 19 /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/docrefs/DocReferenceTest.xtend Xtend Problem
The method mock(Class<Attribute>) is undefined RosettaExpressionJavaGeneratorTest.xtend /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify line: 282 /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify/RosettaExpressionJavaGeneratorTest.xtend Xtend Problem
The method when(Object) is undefined RosettaExpressionJavaGeneratorTest.xtend /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify line: 269 /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify/RosettaExpressionJavaGeneratorTest.xtend Xtend Problem
我尝试过的:
- 右键单击该项目并 运行 Maven > 更新项目...(即 the top anwser of the similar post)
- 正在删除项目并将其重新导入为 Maven 项目
- 正在更新 Maven、m2e Eclipse 插件和 Eclipse 到最新版本
- 运行
mvn clean
,项目 > 清理,关闭并重新打开项目,...并重建
但问题依旧,这三天无果而终,我不知道如何继续。
我不知道这个项目如何或为什么与链接问题中的不同,所以这里有更多详细信息:
> mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Users\Thesis\apache-maven-3.8.1\bin\..
Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.2
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
- JDK Eclipse 中的合规性设置为 11
- 我是 运行 Eclipse DSL 工具版本 2021-06 (4.20.0)
知道如何解决这个问题吗?
对于插件开发,Eclipse 需要配置目标平台。您可以在 com.regnosys.rosetta.target
项目中找到一个目标文件。
如果您使用目标编辑器打开该文件,您将在右上角找到一个按钮,允许您将文件设置为 eclipse 中的活动目标平台。
注意:此题与this one类似,但那里的答案对我不起作用。
我有一个奇怪的问题:在命令行中使用Maven,我的构建是成功的,但是在Eclipse 中导入它仍然显示错误。特别是,我正在尝试构建开源 rosetta-dsl 项目,这是一个包含 Xtext 和 Xtend 文件的多模块 Maven 项目。
运行 mvn clean install
结果如下:
[INFO] Reactor Summary for com.regnosys.rosetta.parent 0.0.0.master:
[INFO]
[INFO] com.regnosys.rosetta.parent ........................ SUCCESS [ 0.282 s]
[INFO] com.regnosys.rosetta.lib ........................... SUCCESS [ 17.832 s]
[INFO] com.regnosys.rosetta ............................... SUCCESS [02:22 min]
[INFO] com.regnosys.rosetta.target ........................ SUCCESS [ 0.114 s]
[INFO] com.regnosys.rosetta.blueprints .................... SUCCESS [ 1.168 s]
[INFO] com.regnosys.rosetta.tests ......................... SUCCESS [ 40.176 s]
[INFO] com.regnosys.rosetta.ide ........................... SUCCESS [ 3.613 s]
[INFO] com.regnosys.rosetta.ui ............................ SUCCESS [ 3.721 s]
[INFO] com.regnosys.rosetta.ui.tests ...................... SUCCESS [ 21.185 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:08 min
[INFO] Finished at: 2021-08-06T14:59:53+02:00
[INFO] ------------------------------------------------------------------------
Eclipse 显示 40 个错误,包括:
Bundle 'net.bytebuddy.byte-buddy' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.lib/META-INF line 16 Plug-in Problem
Bundle 'org.apache.commons.lang3' cannot be resolved MANIFEST.MF /com.regnosys.rosetta/META-INF line 24 Plug-in Problem
Bundle 'org.mockito' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.lib/META-INF line 15 Plug-in Problem
Bundle 'org.mockito' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.tests/META-INF line 20 Plug-in Problem
Bundle 'org.objenesis' cannot be resolved MANIFEST.MF /com.regnosys.rosetta.lib/META-INF line 17 Plug-in Problem
Bundle org.apache.commons.lang3 cannot be resolved build.properties /com.regnosys.rosetta line 21 Plug-in Problem
org.mockito.Mockito cannot be resolved to a type. DocReferenceTest.xtend /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/docrefs line: 19 /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/docrefs/DocReferenceTest.xtend Xtend Problem
The method mock(Class<Attribute>) is undefined RosettaExpressionJavaGeneratorTest.xtend /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify line: 282 /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify/RosettaExpressionJavaGeneratorTest.xtend Xtend Problem
The method when(Object) is undefined RosettaExpressionJavaGeneratorTest.xtend /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify line: 269 /com.regnosys.rosetta.tests/src/com/regnosys/rosetta/generator/java/qualify/RosettaExpressionJavaGeneratorTest.xtend Xtend Problem
我尝试过的:
- 右键单击该项目并 运行 Maven > 更新项目...(即 the top anwser of the similar post)
- 正在删除项目并将其重新导入为 Maven 项目
- 正在更新 Maven、m2e Eclipse 插件和 Eclipse 到最新版本
- 运行
mvn clean
,项目 > 清理,关闭并重新打开项目,...并重建
但问题依旧,这三天无果而终,我不知道如何继续。
我不知道这个项目如何或为什么与链接问题中的不同,所以这里有更多详细信息:
> mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Users\Thesis\apache-maven-3.8.1\bin\..
Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.2
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
- JDK Eclipse 中的合规性设置为 11
- 我是 运行 Eclipse DSL 工具版本 2021-06 (4.20.0)
知道如何解决这个问题吗?
对于插件开发,Eclipse 需要配置目标平台。您可以在 com.regnosys.rosetta.target
项目中找到一个目标文件。
如果您使用目标编辑器打开该文件,您将在右上角找到一个按钮,允许您将文件设置为 eclipse 中的活动目标平台。