Eclipse-wtp Plugin Regression in v2.5

After upgrading to v2.5 I discovered that the output for our eclipse and eclipse-wtp project changed significantly. Some indication of the changes were mentioned in the release notes, mainly that the sub-project dependencies were no longer being set to exported, and instead the transitive dependencies would be directly applied to each project.

This change worked in Eclipse and all projects continued to compile correctly. However there was a negative impact to the assembly and deployment of our WARs with the eclipse-wtp output. The regression is caused by a few JAR projects that are dependencies of the WAR projects.

In the previous model, the JAR projects .classpath would not export the dependencies in the WTP model:

<classpathentry kind="lib" path="/home/pcm/.gradle/caches/modules-2/files-2.1/axis/axis-wsdl4j/1.5.1/bd804633b9c2cf06258641febc31a8ff3b0906bc/axis-wsdl4j-1.5.1.jar" exported="true">
	<attributes>
		<attribute name="org.eclipse.jst.component.nondependency" value=""/>
	</attributes>
</classpathentry>

In 2.5 the output changes to:

<classpathentry kind="lib" path="/home/pcm/.gradle/caches/modules-2/files-2.1/axis/axis-wsdl4j/1.5.1/bd804633b9c2cf06258641febc31a8ff3b0906bc/axis-wsdl4j-1.5.1.jar">
    <attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="../"/>
    </attributes>
</classpathentry>

This breaks the WAR deployment because now all the dependencies of the JAR are deployed in the WEB-INF/lib dir of the WAR. The previous method was correct because the required dependencies to deploy in the WEB-INF/lib dir were correctly defined by the output of the .setttings/org.eclipse.wst.common.component file in the WAR project.

<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib//home/pcm/.gradle/caches/modules-2/files-2.1/axis/axis-wsdl4j/1.5.1/bd804633b9c2cf06258641febc31a8ff3b0906bc/axis-wsdl4j-1.5.1.jar">
	<dependency-type>uses</dependency-type>
</dependent-module>

So now in 2.5, there are duplicate dependencies added to the WAR.

There is a workaround to clear the WTP components from the JAR.

eclipse.wtp {
  component.plusConfigurations.clear()
}

I think the old defaults were correct and should be reverted.

Hey,

thanks for reporting this issue and sorry for the late reply. I’m currently investigating this. In general we did the classpath change to model the eclipse classpath closer to what the actual classpath looks in gradle. It is unlikely that we revert the classpath change itself. We need to find a way to get the WTP tooling working as expected with the new classpath setup. As mentioned, We’re looking into this now.

Hey after looking a bit into this I don’t think it is related to the general classpath changes we did in 2.5. What gradle version have you used before? I think we always generate the “org.eclipse.jst.component.dependency” for java projects since the early beginning. I can’t see where we have changed this behaviour. In general we have plans to fix this (see the design spec at https://github.com/gradle/gradle/blob/master/design-docs/eclipse-wtp-mapping.md) but it has just not bubbled up on top of our priority list.

Would you be interested in contributing a fix for this to Gradle and provide a pull request for this? It shouldn’t be too hard and I can give you with some pointers if you like. Contributing is easier as it sounds. have a look at https://gradle.org/contribute/ for the details.

cheers,
René

Thanks Rene,
I was comparing the output against v2.4. I’ll take another look if you
don’t think it was part of v2.5. I don’t know if I’ll have the time to dig
into the code. If I do I’ll work up a pull request if I can find the source
of the new behavior.

  • Casey

can you create a small reproducable example that shows the difference between 2.5 and 2.6? that would be great? I couldn’t reproduce it yet. I can take it from there.

cheers,
René