My war in eclipse doesn't see jars from other projects

I have a multiple projects like this:

root ----service-jar ----war-project

When I include these projects in my eclipse, the war project hasn’t jars of service-jar in the classpath, so I can’t deploy my war in a server. If I deploy the generated war from war-project/build/libs to my jboss server, all work fine. Maybe I have a bad configuration for eclipse plugin.

Here is my settings.gradle:

include 'service-jar', 'war-project'

Here is my root/build.gradle:

allprojects {
    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'eclipse-wtp'
       repositories {
     maven {
      name "jboss"
      url ""

Here is my service-jar/build.gradle:

dependencies {
 compile 'org.springframework:spring-core:3.0.7.RELEASE',

Finally, here is my war-project/build.gradle:

  apply plugin: 'war'
dependencies {
 compile project(':service-jar')

What is wrong in my configuration ?

Thanks for your help.

I have the same problem and I don’t yet have a great answer. I’d appreciate any thoughts.

I have a similar setup to what you describe. If I run “gradle eclipse” and then open the project in Eclipse, there are no errors in the Problems view. But if I go to Project | Properties | Deployment Assembly, there will be a message “Cannot find entry ‘service-jar’”.

I compared the .settings/org.eclipse.wst.common.component file generated by Gradle and the file generated by creating a Dynamic Web Project via the Eclipse UI. I found one difference, that the Gradle plugin doesn’t add an archiveName attribute to the dependent-module element for the referenced project. So I tweaked my Gradle script to add that, but the error does not go away.

So for now I perform a manual step in Deployment Assembly. I remove the entry for the service-jar, and add it right back. Then Eclipse is happy.

Desired dependent-module element (modified to fit your example)::

<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/service-jar/service-jar" archiveName="service-jar.jar">

Tweaked Gradle script (only the relevant portion):

eclipse {
    wtp {
        component {
            file {
                withXml {
                        .findAll { == 'dependent-module' }
                        .findAll { it.attribute('handle').startsWith 'module:/resource' }
                        .each {
                            jarName = it.attribute('handle').tokenize('/').last() + '.jar'
                            it.attributes().put('archiveName', jarName)

Just add “apply plugin: ‘eclipse-wtp’” even to referenced jar project.

Worked for me.

1 Like

I just solved this problem for myself so I’ll post what the problem was and how I fixed it.

It appears this problem with dependent jar project happens when that project doesn’t have ModuleCoreNature. One solution as Kamil Tomšík says is to add the ‘eclipse-wtp’ gradle plugin.

However I had customised the natures applied to my eclipse project and so the ModuleCoreNature was not being applied and I got this “Cannot find entry ‘service-jar’” type error.

So I added the following to my jar project gradle file:

eclipse {
     project {
      natures 'org.eclipse.wst.common.modulecore.ModuleCoreNature'