Buildship 2.0 imported dependency non-modifiable in eclipse

I installed latest Buildship 2.0 in my eclipse. I imported a gradle multi module project and source files for all the dependencies show up as non-modifiable. How can i add source files or directories to gradle imported dependencies.

The dependencies are synchronised with the content of your build scripts. If you define a new dependency in the script, like

dependencies {
    compile 'junit:junit:4.12'

then right-click on the project and select Gradle > Refresh Gradle Project, you’ll see the dependency added to the Project and External Dependencies node.

Or you want to modify the dependencies? They’re binary jar files with sources attached, therefore you can’t simple edit them.
Can you please give us an example and some context what you’re trying to achieve?

I have Project B that depends on jars from Project A. Project A only builds binary jars and not source jars. When I import dependencies for project B, project A jars are non-modifiable. I cannot attach source code folder to them.

If you are using a Gradle 3.0+ version you can customise the classpath in the build script. Here’s the snippet to attach a source jar to a dependency:

import org.gradle.plugins.ide.eclipse.model.Library

apply plugin: 'java'
apply plugin: 'eclipse'

eclipse {
    classpath {
        file {
            whenMerged { 
                def lib = entries.find { it.path.contains 'my-commercial-lib.jar' }
                lib.sourcePath = fileReference(file('libs/m-commercial-lib-source.jar'))

FYI you’l find this, and a lot more useful examples in the Buildship 1.0.18 release announcement.