[GRADLE-1422] Improper .classpath generation causes WTP to deploy all of the war's dependant project's dependencies Created: 05/Mar/11  Updated: 05/Dec/14  Resolved: 05/Dec/14

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-1
Fix Version/s: 2.3-rc-1

Type: Bug
Reporter: Rob Winch Assignee: Radim Kubacki
Resolution: Fixed Votes: 3

Attachments: Text File init.gradle.txt     Zip Archive wtp-bug.zip    

 Description   

Every entry classpathentry in the .classpath that is a Library contains an attribute org.eclipse.jst.component.dependency. This means that test and provided dependencies of projects that the war depends on are also included in the war. In some cases this can cause the application to fail to start. For example, when the wrong jsp-api version is included JSPs fail to compile. I have attached a sample project to illustrate the issue. I have also attached init.gradle that provides a workaround for anyone else experiencing this issue. Below the actual .classpath file and the expected .classpath files are displayed.

Actual .classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="output" path="bin"/>
	<classpathentry kind="src" path="src/main/java"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
	<classpathentry sourcepath="/home/rwinch/.gradle/cache/junit/junit/sources/junit-4.7-sources.jar" kind="lib" path="/home/rwinch/.gradle/cache/junit/junit/jars/junit-4.7.jar" exported="true">
		<attributes>
			<attribute name="org.eclipse.jst.component.dependency" value="../"/>
		</attributes>
	</classpathentry>
</classpath>
Expected .classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="output" path="bin"/>
	<classpathentry kind="src" path="src/main/java"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
	<classpathentry sourcepath="/home/rwinch/.gradle/cache/junit/junit/sources/junit-4.7-sources.jar" kind="lib" path="/home/rwinch/.gradle/cache/junit/junit/jars/junit-4.7.jar" exported="true"/>
</classpath>


 Comments   
Comment by Magnus Heino [ 13/Nov/12 ]

This makes gradle + eclipse wtp pretty useless for me :-P

Is there an updated workaround available for Gradle 1.2? Thanks.

Comment by Radim Kubacki [ 05/Dec/14 ]

Fixed provided by Andreas Schmid. Thanks for the contribution.

Generated at Wed Jun 30 11:55:09 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.