Unable to browse source code of external dependencies in Eclipse-Buildship projects

I imported a gradle project into eclipse using Buildship plugin. All features seem to work fine but I’m unable to browse source code of external dependencies. This usually works in my maven projects so I’m guessing it could be related to Buildship (or not). Any inputs? Thanks.

The error I get is “The JAR of this class file belongs to container ‘Project and External Dependencies’ which does not allow modifications to source attachments on its entries”

Source attachments should work just fine, could you please provide a reproducible example project?

I added jtds 1.3.1 as a compile dependency to one of my example projects and the sources are attached in Buildship.

Thanks for the reply.

I created a sample project with following spec.

apply plugin: 'java'
repositories {  mavenCentral() }
dependencies { 
    compile group: 'net.sourceforge.jtds', name: 'jtds', version: '1.3.1'

Source attachments worked just fine. Even in my large project (which cannot be pasted here), majority of my source attachments seemed to work except jTDS. I’m not sure why but at least now I know that it’s not a missing feature.

Maybe your project transitively depends on a version of jtds which misses source attachments. Maybe a snapshot? People often don’t attach sources to snapshots. Just guessing :slight_smile:

I had the same problem with JDBC driver jar. An update to the latest patch version helped, so it was either caching issue or the version that i previously had was missing the sources (as suggested above).