Is there a way to specify the source jar location for a file dependency?


I have a multi-java-project setup in Eclipse with a few libraries which do not exist in any repository that I know of. So I have a global ‘lib’ directory where I store the binary and source archives. A few projects then declare some file dependencies when necessary.

Is there a way to configure the eclipse plugin so that when generating the .classpath file, it includes the location of the source jar and/or the javadoc for the file dependencies? I checked the SelfResolvingDependency interface definition and I didn’t see anything that could help me do that so I’m guessing that’s not possible.

Thank you.

Simpler than defining your special repository format where you will associate JARs with their sources is to use ‘withXml’ hook in Eclipse plugin and modify generated ‘.classpath’ file. Some references: and and you will put your code into block like this: ‘’’ eclipse {

classpath {

file {

withXml {

def node = it.asNode()


} } ‘’’

If I’m not mistaken, Gradle 1.12 will do this automatically for file dependencies whose sources Jars have a ‘sources’ classifier, and whose Javadoc Jars have a ‘javadoc’ classifier.

Is there a way to do this if the javadocs/sources are not in a jar but in expanded form on the local filesystem?

It should be possible with post-processing of the ‘.classpath’ file.

Well, as a hack to work around it, sure. But this needs to be something that the tooling API can handle. I want to use NetBeans anyway :slight_smile:

AFAICT if you modify idea model with a similar hook that Peter was suggesting (see withXml in NetBeans will likely pick it up.