Skip to content
Advertisement

Maven builds multi module project succesfully, Eclipse shows errors

Note: this question is similar to this one, but the answers there did not work for me.

I have an odd problem: using Maven in the command line, my build is succesful, but imported in Eclipse it still shows errors. In particular, I’m trying to build the open-source rosetta-dsl project, which is a multi module Maven project containing Xtext and Xtend files.

Running mvn clean install ends with the following result:

[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 shows 40 errors, including:

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

What I have tried:

  • Right-clicking on the project and running Maven > Update Project… (which is the top anwser of the similar post)
  • Deleting the project and reimporting it as a Maven project
  • Updating Maven, the m2e Eclipse plugin and Eclipse to the latest version
  • Running mvn clean, Project > Clean, closing and reopening the project, … and rebuilding

but the problem persists, and after fruitlessly searching for a solution for the last three days, I’m not sure how to continue.

I don’t know how or why this project behaves differently from the one in the linked question, so here are more details:

  • > mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:UsersThesisapache-maven-3.8.1bin..
Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:Program FilesJavajdk-11.0.2
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
  • JDK compliance in Eclipse is set to 11
  • I’m running Eclipse DSL Tools version 2021-06 (4.20.0)

Any idea how to solve this?

Advertisement

Answer

For plugin-development, Eclipse needs to have a target platform configured. You can find a target file in the com.regnosys.rosetta.target project. If you open that file with the target editor you will find a button in the top right that allows you to set the file as active target platform in your eclipse.

Advertisement