Subproject dependencies missing in Eclipse-wtp/war project?


(Jeroen van der Vegt) #1

Hi,

In a multi-project setup (in both Eclipse and Gradle), I have a web project and a ‘util’ project. The latter is depending on third-party libraries. Those libraries are resolved by Gradle from mavenCentral. On disk, it looks like this:

+--gradle
|
  +--gradle.properties
|
  +--settings.gradle
|
  \--build.gradle
|
+--util
|
  +--build.gradle
|
  \--src
|
       +-- ...
|
\--war
     +--build.gradle
     \--src
          +-- ...

Generating the WAR using Gradle works fine, but I’d like to deploy to an embedded JBoss server from within Eclipse. I’m applying the ‘eclipse-wtp’ plugin on the WAR project, but Gradle generates an incorrect ‘org.eclipse.wst.common.component’ file in the .settings folder. Two things seem incorrect: 1. The deploy path is missing the name of the project included:

<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/util/util">
    <dependency-type>uses</dependency-type>
</dependent-module>

If I fix this in Eclipse, the deploy-path becoomes “/WEB-INF/lib/util” .

  1. All libraries required by the util library are missing in this file.

Does the eclipse-wtp plugin need any configuration for this? I was hoping it would work by merely adding ‘apply plugin:eclispe-wtp’ to war/build.gradle .


(Peter Niederwieser) #2

Have you tried to apply the plugin to all projects (including the root project)? From what I know, it usually gets the external libs right.


(Jeroen van der Vegt) #3

Thanks! Indeed the root project need the plug in, and both the ‘util’ and ‘war’ projects.


(oliver.kopp) #4

This doesn’t seem to work for non-war projects. In my case, the project org.example.util should be added with the Deploy Path “WEB-INF/lib/org.example.util.jar” and all the dependencies of it should be in. Gradle adds “WEB-inf/lib” as target and does not recursively add the dependencies. (Gradle 1.6)


(Radim Kubacki) #5

There are two parts of the problem discussed here:

  1. how are war project dependencies handled by eclipse-wtp plugin to make sure that the application can be deployed with them 2. how to handle transitive dependencies

As for the first part it looks broken to me. To fix the generated setup I had to change the output to

<dependent-module archiveName="util.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/util/util">
      <dependency-type>uses</dependency-type>
    </dependent-module>

i.e. add

archiveName=“project-name.jar”
(or maybe you can use WEB-INF/lib/util.jar as a deploy-path and skip this attribute. I did this with Eclipse Kepler SR2 + WTP Web Developer Tools 3.5.2. If someone can confirm that this works well I can change how it is generated by ‘gradle eclipseWtp’ (please mention your Eclipse version then).