Eclipse Buildship Dependencies Source Attachment

I have following dependencies defined in my build.gradle file:

apply ‘java’

dependencies{
implementation ‘groupID:artifactID:version-SNAPSHOT’
implementation ‘groupID:artifactID:version-SNAPSHOT:sources’
}

This dependency is being downloaded from a shared-team Maven repo. The dependency artifacts include a .jar, *sources.jar and a pom file. Everything works as expected - except the source is not attached in the Project and External Dependencies buildpath with Eclipse Buildship for the project referencing the dependencies. The jars are there but the source attachment is empty. I have verified .gradle cache does indeed have the source and the source looks right.

It seems the source code for other dependencies (publicly available dependencies and another proprietary project dependency - a gradle project ) have source attached. But the proprietary project in question (which is Maven based) does not attach source.

Is there something I am doing incorrectly via build.gradle?

I don’t think you need to declare the dependency with sources classifier to the sources. If the sources are available, then Buildship attaches them to the corresponding jar in the classpath, unless the functionality is disabled in the eclipse plugin configuration.

Without an actual example, it will be hard to investigate your case. I’d suggest check and - if nothing else works - modify the sourcepath property of the dependencies in the whenMerged block. You’ll find examples how to do that here.