Eclipse war project missing dependencies


(Michael Bevilacqua) #1

Eclipse war project missing dependencies. When using gradle to build a project, the .war file is correct. However, the eclipse .classpath does not include the dependencies properly. Specifically, when I add the following snippet manually, this resolves properly in the eclipse and the tomcat manages by eclipse now has the dependencies.

How do I modify gradle to generate the eclipse .classpath with this attribute?

CORRECT:

<classpathentry
         path="D:/Users/michaelb/.gradle/caches/.../camel-core-2.12.1.jar"
        sourcepath="D:/Users/michaelb/.gradle/caches/.../camel-core-2.12.1-sources.jar">
        <attributes>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib" />
        </attributes>
    </classpathentry>

INCORRECT, WHAT GRADLE GENERATES IS MISSING ATTRIBUTES:

<classpathentry
         path="D:/Users/michaelb/.gradle/caches/.../camel-core-2.12.1.jar"
        sourcepath="D:/Users/michaelb/.gradle/caches/.../camel-core-2.12.1-sources.jar">
    </classpathentry>

(Peter Niederwieser) #2

Do you generate Eclipse files (‘gradle eclipse’) or use the Eclipse Gradle tooling? Do you apply the ‘eclipse-wtp’ project to all projects (including the root project)?


(Michael Bevilacqua) #3

I use the command gradle eclipse, as I am not familiar with Eclipse Gradle tooling. Eclipse-wtp is only applied to single project, not root projects.


(Peter Niederwieser) #4

I think ‘eclipse-wtp’ needs to be applied to all projects, including the root project.


(Michael Bevilacqua) #5

Great, applying this to the root project fixed it. Thanks Peter.