How to import dependent projects without errors


(Cristian Ghezzi) #1

I have one web project called “SmileIn” and a library called “YadaWeb”.
The dependency between them is set in the settings.gradle file of the web project:

include 'YadaWeb'
project(':YadaWeb').projectDir = "../../yadaframework/YadaWeb" as File

When I import the SmileIn project for the first time using “File > Import > Gradle Project” the plugin correctly identifies the dependency:

When I check the “Properties > Deployment Assembly” of the web project though, I see the error “Cannot find entry: ‘YadaWeb’”.

If I export a war, the YadaWeb.jar is not present in the lib folder.

Next I remove the entry from the Deployment Assembly and add it manually as a project dependency in the usual eclipse way. Then the YadaWeb project complains about being set on java 1.6, which I can fix manually (both in the Compiler level and in the facets).

At this point all is working fine, but not for long: as soon as I issue “Refresh Gradle Project” on SmileIn, the outcome differs between Buildship 1.0.21 and Buildship 2.0.0: while the former happily exports the YadaWeb jar in the war, the latter goes back to the initial error “Cannot find entry: ‘YadaWeb’”.

I don’t know if this is a bug, an unimplemented feature or misuse on my part.

(Stefan Oehme) #2

Does YadaWeb apply the eclipse-wtp plugin? It cannot be referenced by other web projects in Eclipse without that.

(Cristian Ghezzi) #3

That was easy :blush:
After applying eclipse-wtp as suggested, all is working fine.