[GRADLE-1412] org.eclipse.jst.component.dependency attribute not set when using variables Created: 02/Mar/11  Updated: 04/Jan/13  Resolved: 24/Apr/12

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

Type: Bug
Reporter: Matt Accola Assignee: Szczepan Faber
Resolution: Fixed Votes: 0


 Comments   
Comment by Matt Accola [ 02/Mar/11 ]

Somehow my description didn't get posted...anyways here it is...

One of the new features of 1.0-milestone-1 causes an org.eclipse.jst.component.dependency attribute to be added to classpath entries in projects that a Dynamic Web Project depends on, see http://jira.codehaus.org/browse/GRADLE-1275. This works correctly in most cases but if the eclipseClasspath task hook is configured to use a variable for GRADLE_CACHE then the attribute is no longer added.

Here is the the gradle script snippet that breaks the feature. Adding this snippet to the build.gradle file in the "depended upon project" will manifest the error.

eclipseClasspath {
    variables << [ "GRADLE_CACHE" : new File(gradle.getStartParameter().getGradleUserHomeDir(), "cache") ]
}

Here is the expected output for a classpath entry

<classpathentry sourcepath="/home/mraccola/.gradle/cache/commons-collections/commons-collections/sources/commons-collections-3.2-sources.jar" 
    kind="lib" 
    path="/home/mraccola/.gradle/cache/commons-collections/commons-collections/jars/commons-collections-3.2.jar" 
    exported="true">
    <attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="../"/>
    </attributes>
</classpathentry>

Here is the actual output for a classpath entry

<classpathentry sourcepath="GRADLE_CACHE/commons-collections/commons-collections/sources/commons-collections-3.2-sources.jar" 
    kind="var" 
    path="GRADLE_CACHE/commons-collections/commons-collections/jars/commons-collections-3.2.jar" 
    exported="true"/>

One clue as to the cause is that the kind attribute of the classpath entry is changed from lib to var.

Comment by Peter Niederwieser [ 26/Apr/11 ]

Why do you expect GRADLE_CACHE not to appear in sourcepath and path?

Comment by Matt Accola [ 26/Apr/11 ]

No, it is fine for GRADLE_CACHE to appear in the sourcepath and path.

The issue is that the "org.eclipse.jst.component.dependency" attribute is not added when the GRADLE_CACHE variable is used.

Comment by Peter Niederwieser [ 26/Apr/11 ]

I understand that, but your expected output doesn't make use of the GRADLE_CACHE variable. So I guess we should expect the following output?

<classpathentry sourcepath="GRADLE_CACHE/commons-collections/commons-collections/sources/commons-collections-3.2-sources.jar" 
    kind="var" 
    path="GRADLE_CACHE/commons-collections/commons-collections/jars/commons-collections-3.2.jar" 
    exported="true">
    <attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="../"/>
    </attributes>
</classpathentry>
Comment by Matt Accola [ 26/Apr/11 ]

Yeah, you are right. Your code snippet is the correct one. Sorry about that.

Comment by Szczepan Faber [ 10/Mar/12 ]

Hey guys, I'm just looking to fix some of the wtp issues. Why the dependency value is "../"? I.e. in: <attribute name="org.eclipse.jst.component.dependency" value="../"/>

Comment by Szczepan Faber [ 15/Mar/12 ]

Nevermind, I found out what the problem was.

Comment by Szczepan Faber [ 24/Apr/12 ]

The dependency attribute is now correctly set also for variables.

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