[GRADLE-1056] eclipse plugin duplicates src/main/java entry in .classpath Created: 27/Jul/10  Updated: 04/Jan/13  Resolved: 11/Dec/11

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

Type: Bug
Reporter: Philip Crotwell Assignee: Unassigned
Resolution: Fixed Votes: 4

Attachments: File dupSourceInEclipse.tgz    
Issue Links:
Duplicate
Duplicated by GRADLE-1984 Running gradle eclipse twice results ... Resolved

 Description   

The fix for GRADLE-644 now has "exported=true" but seems to also duplicate the src/main/java entry.

Eclipse complains with:
Build path contains duplicate entry: 'src/main/java' for project 'seisFile'



 Comments   
Comment by Hans Dockter [ 28/Jul/10 ]

I can't reproduce this problem. Could you provide a test case?

Comment by Hans Dockter [ 29/Jul/10 ]

I can reproduce this problem now under windows. It is related to the file separator. This is fixed now in trunk.

Comment by Philip Crotwell [ 05/Aug/10 ]

I am still seeing this and will attach my test case shortly. The behavior is not consistent however, and removing the .classpath before running gradle eclipse seems to make it work correctly, although this could just be coincidence. Here is an example. Note that in the first instance, the .classpath was already there in both subprojects, and after running gradle eclipse there are 2 entries for src/main/java in the .classpath for TauP, although only one for seisFile. TauP depends on seisFile, so perhaps that is related.

But then, after removing all the .classpath files and rerunning gradle eclipse, the TauP/.classpath only has one entry for src/main/java. Running it over and over again has so far not reproduced the duplication problem.

However, if I manually edit the TauP/.classpath and add the duplication with this line:
<classpathentry kind="src" path="src/main/java"/>
and then rerun gradle eclipse, the duplication is there. Also, if I just edit that line to remove the "output" attribute, the duplication will show up. Does the eclipse plugin try to preserve the items in the .classpath if it already exists? Perhaps there is some rare situation that leads to the duplication, and then once it is there it is preserved?

thanks
Philip

crotwell$ gradle eclipse ; grep src/main/java */.classpath
:TauP:eclipseClasspath
:TauP:eclipseProject
:TauP:eclipse
:seisFile:eclipseClasspath
:seisFile:eclipseProject
:seisFile:eclipse

BUILD SUCCESSFUL

Total time: 5.366 secs
TauP/.classpath: <classpathentry kind="src" path="src/main/java"/>
TauP/.classpath: <classpathentry output="build/classes/main" kind="src" path="src/main/java"/>
seisFile/.classpath: <classpathentry output="build/classes/main" kind="src" path="src/main/java"/>
crotwell$ rm */.classpath ; gradle eclipse ; grep src/main/java */.classpath
:TauP:eclipseClasspath
:TauP:eclipseProject
:TauP:eclipse
:seisFile:eclipseClasspath
:seisFile:eclipseProject
:seisFile:eclipse

BUILD SUCCESSFUL

Total time: 3.745 secs
TauP/.classpath: <classpathentry output="build/classes/main" kind="src" path="src/main/java"/>
seisFile/.classpath: <classpathentry output="build/classes/main" kind="src" path="src/main/java"/>

Comment by Philip Crotwell [ 05/Aug/10 ]

Test case for duplication of src/main/java.

> cd dupSourceInEclipse
> gradle eclipse
:TauP:eclipseClasspath
:TauP:eclipseProject
:TauP:eclipse
:seisFile:eclipseClasspath
:seisFile:eclipseProject
:seisFile:eclipse

BUILD SUCCESSFUL

Total time: 3.986 secs
> grep src/main/java */.classpath
TauP/.classpath: <classpathentry kind="src" path="src/main/java"/>
TauP/.classpath: <classpathentry output="build/classes/main" kind="src" path="src/main/java"/>
seisFile/.classpath: <classpathentry output="build/classes/main" kind="src" path="src/main/java"/>

Comment by Hans Dockter [ 06/Aug/10 ]

Thanks a lot for the test case. Which version of Gradle are you using? On what OS are you?

Yes. Gradle is merging existing .classpath entries (see the user's guide of rc1). But the plugin is supposed to deal with equal entries. Which works for me when using your test case (e.g. adding a manual entry in TauP/.classpath). I don't get duplicates then.

Comment by Philip Crotwell [ 06/Aug/10 ]

Sorry about the version, I should have included that. It seems to still be happening with gradle 0.9-rc1.

das-admins-macbook-pro-15:~/dupSourceInEclipse crotwell$ cd TauP
das-admins-macbook-pro-15:~/dupSourceInEclipse/TauP crotwell$ gradle --version

------------------------------------------------------------
Gradle 0.9-rc-1
------------------------------------------------------------

Gradle buildtime: Wednesday, 4 August 2010 8:04:33 AM EST
Groovy: 1.7.3
Ant: Apache Ant version 1.8.1 compiled on April 30 2010
Ivy: 2.2.0-rc1
Java: 1.6.0_20
JVM: 16.3-b01-279
JVM Vendor: Apple Inc.
OS Name: Mac OS X

das-admins-macbook-pro-15:~/dupSourceInEclipse/TauP crotwell$ grep src/main/java .classpath
<classpathentry kind="src" path="src/main/java"/>
<classpathentry output="build/classes/main" kind="src" path="src/main/java"/>
das-admins-macbook-pro-15:~/dupSourceInEclipse/TauP crotwell$ gradle eclipse
:TauP:eclipseClasspath
:TauP:eclipseProject
:TauP:eclipse

BUILD SUCCESSFUL

Total time: 3.936 secs
das-admins-macbook-pro-15:~/dupSourceInEclipse/TauP crotwell$ grep src/main/java .classpath
<classpathentry kind="src" path="src/main/java"/>
<classpathentry output="build/classes/main" kind="src" path="src/main/java"/>
das-admins-macbook-pro-15:~/dupSourceInEclipse/TauP crotwell$

Comment by Raul Piaggio [ 03/Jan/11 ]

We love Gradle and we rely heavily on the eclipseClasspath functionality, but we have been unable to move past 0.9-preview3 because of this issue.

Thank you.

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