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

eclipse

(Phanindra) #1

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”


(Stefan Oehme) #2

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.


(Phanindra) #3

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.


(Stefan Oehme) #4

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:


(Desislav Kamenov) #5

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