Eclipse classpath - project root as srcDir


(zyro) #1

defining a srcDir “.” results in an eclipse .classpath entry with path="." which eclipse does not like. looks like eclipse wants “” as path if the project root is defined as a src dir.

any way to solve this without manually modifying the generated classpath entry (whenMerged/withXml)? i would like to use the eclipse “refresh dependencies” feature which does currently not respect manual classpath modifications. (please do not ask about the project layout - i know this is terrible…)


(Peter Niederwieser) #2

Have you tried ‘srcDir projectDir’? If that doesn’t help, I can’t think of a solution other than modifying the generated classpath entry.


(zyro) #3

also generates path="."… for the time being, i will be modifying the entries manually. anyway i think gradle should perhaps generate a eclipse classpath entry with path="" when it has a srcDir “.” - thanks, zyro


(Peter Niederwieser) #4

Raised GRADLE-3096. If you are interested in contributing a fix, let us know.


(zyro) #5

surething. planning to add sth like

sourceFolders.find { it.path == "." }.path = ""

to https://github.com/gradle/gradle/blob/master/subprojects/ide/src/main/groovy/org/gradle/plugins/ide/eclipse/model/internal/SourceFoldersCreator.groovy#L47 - just making sure im heading in the right direction?


(Peter Niederwieser) #6

Sounds good. The goal would be to have a functional test that proves it right.

Please also read https://github.com/gradle/gradle/blob/master/CONTRIBUTING.md

Thanks!


(zyro) #7

oh thanks for that pointer. not planning to sign sucha contrib agreement atm. will comment the planned approach on jira for further reference.