Eclipse classpath - project root as srcDir

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…)

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

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

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

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?

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!

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