Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach Sources for gradleApi() and Similar Dependencies #547

Closed
cspurk opened this issue Aug 10, 2017 · 3 comments
Closed

Attach Sources for gradleApi() and Similar Dependencies #547

cspurk opened this issue Aug 10, 2017 · 3 comments

Comments

@cspurk
Copy link

cspurk commented Aug 10, 2017

When using Gradle distribution specific dependencies like gradleApi() or gradleTestKit(), Buildship doesn’t attach the sources to the corresponding Eclipse build path dependencies. When working on Gradle plugins, such sources (and the corresponding Javadoc) would often be very helpful, though.

@AndyWu2015
Copy link
Contributor

agree with that , I think buildship should download the source jar and attach it just like m2e.

@samized
Copy link

samized commented Mar 16, 2018

Would be nice if buildship can solve this problem: gradle/gradle#1003

Unfortunately one of the later buildship releases break my workaround:

plugins.withType(EclipsePlugin) {
  plugins.withType(JavaBasePlugin) {
    eclipse {
      classpath {
        file {
          whenMerged { cp ->
            String gradleHome = gradle.getGradleHomeDir().absolutePath.replace(File.separator, '/')
            String gradleSrc = "${gradleHome}/src"
            cp.entries.each { entry ->
              if ((entry in AbstractLibrary) && (entry.library.path.contains('generated-gradle-jars'))) {
                entry.sourcePath = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory().fromPath(gradleSrc)
              }
            }
          }
        }
      }
    }
  }
}

Is the a way to modify the GradleClasspathContainer like this?

@oehme
Copy link
Contributor

oehme commented Mar 19, 2018

Closing, since this is already tracked by gradle/gradle#1003 and needs to be done in Gradle, not Buildship.

@samized Your workaround should work fine. Have you put some logging in there to see if it is getting invoked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants