[GRADLE-1078] eclipse .classpath generation should order source folders per usual conventions Created: 29/Jul/10  Updated: 04/Jan/13  Resolved: 13/Jan/11

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: 0.9.2

Type: Improvement
Reporter: Chris Beams Assignee: Peter Niederwieser
Resolution: Fixed Votes: 0

Issue Links:
Duplicate
Duplicated by GRADLE-1218 Generated Eclipse classpath should or... Resolved

 Description   

gradle-generated .classpath files currently order source folders in a way that violates expectations.

Actual ordering:

src/main/resources
src/main/java
src/test/resources
src/test/java

Expected ordering:

src/main/java
src/main/resources
src/test/java
src/test/resources


 Comments   
Comment by Peter Niederwieser [ 13/Jan/11 ]

Chris,

I have some questions:

1. Is this an aesthetic issue, or does it have deeper impacts?
2. Is it good enough to enforce that "java" comes before "resources", or is it also important that "main" comes before "test" (currently this is probably a coincidence)?
3. Is it desirable that source set "main" comes before source set "test" even if the source dirs are reconfigured to, say, "src/java" and "test/java"?

Comment by Chris Beams [ 13/Jan/11 ]

Hi Peter,

(1) It is cosmetic, but important. As I'm sure you're aware, there's a strong convention, especially from a Maven perspective to order things as follows:

src/main/java
src/main/resources
src/test/java
src/main/resources

Seeing things reversed or otherwise out of the ordinary makes the user feel like the IDE integration is an afterthought (it's off-putting at least).

(2) I think it's important to enforce main first, then test in any case.

(3) Yes. I think it adheres to the principle of least surprise.

Thanks!

Comment by Peter Niederwieser [ 13/Jan/11 ]

Given the following build script...

apply plugin: "java"
apply plugin: "groovy"
apply plugin: "eclipse"

sourceSets {
    integTest {
        resources {
            srcDir "src/integTest/resources"
        }
        java {
            srcDir "src/integTest/java"
        } 
        groovy {
            srcDir "src/integTest/groovy"
        }              
    }
}

...source folders are now ordered as follows:

"src/main/java"
"src/main/groovy" // all other source folders come in between "java" and "resources"
"src/main/resources"
"src/test/java"
"src/test/groovy"
"src/test/resources"
"src/integTest/java" // all other source sets come after "main" and "test"
"src/integTest/groovy"
"src/integTest/resources"

Does this match your expectations?

Comment by Chris Beams [ 13/Jan/11 ]

Yes, perfect!

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