Configuring source jars for gradle dependencies

Answered

Is there a way to configure source jars for dependencies from the gradle build files when using IntelliJs import?

For Eclipse/Buildship I do the following in build.gradle because Buildship uses the eclipse dsl in the gradle files:

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

dependencies {
compile group: "somegroup", name: 'stuff'
testCompile group: "somegroup", name: 'stuff', classifier: "test"
}

repositories {
flatDir name: "flatdir-repo", dir: "stuffimports/"
}

eclipse {
classpath {
file {
whenMerged {
def libs = entries.findAll { it.path ==~ /.+stuff(|-test)\.jar$/ }
libs.each {
it.sourcePath = fileReference(file(it.path.replaceAll(/\.jar/, /-src.jar/)))
}
}
}
}

Basically: Is there any documentation on how/if the IntelliJs "Import existing module from Gradle" interacts with Gradle's 'idea' plugin? Or any good examples?

https://www.jetbrains.com/help/idea/2017.1/gradle.html and https://docs.gradle.org/current/userguide/idea_plugin.html doesn't say anything about this.

/Thanks

4 comments
Comment actions Permalink

Is there any documentation on how IntelliJ's Gradle import interacts with the Gradle's 'idea' plugin?

0
Comment actions Permalink

Is there any work being done at improving this integration?

I have seen that the gradle team is looking at being able to opening gradle itself directly instead of needing to use the gradle idea plugin.

0
Comment actions Permalink

For anyone finding this via search, I created https://youtrack.jetbrains.com/issue/IDEA-188704

EDIT: Was wrong link, fixed.

0

Please sign in to leave a comment.