[GRADLE-1953] "gradle eclipse" creates duplicate classpath entries in 1.0-milestone-6 Created: 22/Nov/11  Updated: 04/Jan/13  Resolved: 30/Nov/11

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-6
Fix Version/s: 1.0-milestone-7

Type: Bug
Reporter: Ben McCann Assignee: Daz DeBoer
Resolution: Fixed Votes: 0

Issue Links:
Duplicates GRADLE-1984 Running gradle eclipse twice results ... Resolved


Running "gradle eclipse" multiple times will create an invalid .classpath file. You can see below that it has added the source path "java" multiple times along with "resources". This did not happen with 1.0-milestone-5 and older.

<?xml version="1.0" encoding="UTF-8"?>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="src" path="java"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
<classpathentry kind="src" path="java"/>
<classpathentry kind="src" path="resources"/>

My build.gradle has:
sourceSets {
main {

{ srcDir 'java' }


{ srcDir 'resources' }

test {

{ srcDir 'javatests' }


Seems like 1.0-milestone-6 is significantly faster than the previous versions, but I'm going to have to revert until this issue is fixed. Can't wait to be able to take advantage of the speed improvements though!

Comment by Daz DeBoer [ 29/Nov/11 ]

I've confirmed this is an issue. We'll try to get a fix out of Milestone-7.
In the meantime, you can use "gradle cleanEclipseClasspath eclipse" to workaround this issue.

Comment by Daz DeBoer [ 29/Nov/11 ]

I've tracked down the cause of this. For those interested:

1) The SourceFolder loaded from eclipse .classpath has no "dir" value set
2) The SourceFolder generated from the SourceSet has a "dir" value set
3) "dir" is included in SourceFolder.equals()
4) A bug in Groovy < 1.8 Collection.unique() meant that previously, "duplicate" SourceFolders were being (incorrectly) removed. (Groovy < 1.8 wasn't using .equals() for comparison).
5) Milestone 6 upgraded to Groovy 1.8, so we don't recognise these SourceFolders as being duplicates any more, since Groovy 1.8 correctly uses .equals() for comparison.

Fix should be straightforward, now that the cause has been revealed!

Generated at Wed Jun 30 12:08:49 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.