# Custom Plugins Don't Include Source

**URL:** <https://discuss.gradle.org/t/custom-plugins-dont-include-source/5651>\
**Category:** Old Forum Archive\
**Created:** [October 16, 2013, 11:01pm UTC](https://discuss.gradle.org/t/custom-plugins-dont-include-source/5651 "2013-10-16T23:01:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![w25r](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/w25r/32/6086_2.png) [@w25r](https://discuss.gradle.org/u/w25r)\
**Post date:** [October 16, 2013, 11:01pm UTC](https://discuss.gradle.org/t/custom-plugins-dont-include-source/5651/1 "2013-10-16T23:01:00Z")

</div>

For a custom gradle plugin, you have the following lines:

dependencies {

compile gradleApi()

compile localGroovy()

}

But when applying the eclipse plugin, and building the classpath. It doesn’t include sources. Is there an easy way to get source jars along with the gradleApi and localGroovy?

The most useful would be the gradle sources, but it would be nice for everything to be included.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [October 17, 2013, 12:52am UTC](https://discuss.gradle.org/t/custom-plugins-dont-include-source/5651/2 "2013-10-17T00:52:00Z")

</div>

Unfortunately, there is no easy way. What I’ve done before is to download the Gradle distro and configure ‘eclipseClasspath’ to attach the distro’s ‘src’ directory to each Jar that has ‘gradle’ in its name.

---

<div class="post-metadata">

**Author:** ![w25r](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/w25r/32/6086_2.png) [@w25r](https://discuss.gradle.org/u/w25r)\
**Post date:** [October 17, 2013, 2:13pm UTC](https://discuss.gradle.org/t/custom-plugins-dont-include-source/5651/3 "2013-10-17T14:13:00Z")

</div>

Not to be lazy… but mind posting the code that does that?

---

<div class="post-metadata">

**Author:** ![w25r](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/w25r/32/6086_2.png) [@w25r](https://discuss.gradle.org/u/w25r)\
**Post date:** [November 15, 2013, 11:14pm UTC](https://discuss.gradle.org/t/custom-plugins-dont-include-source/5651/4 "2013-11-15T23:14:00Z")

</div>

Not ideal, but this works:

eclipse.classpath.file.withXml { classpath -\>

String srcDir = “${gradle.gradleHomeDir}/src”.replace("\", “/”)

classpath.asNode().each { groovy.util.Node node -\>

if ( node.@kind == “lib” && node.@path.contains(’/gradle’)) {

node.@sourcepath = srcDir

}

}

}

This assumes you’re running with a gradle distro that has the source included.
