# Sources included in jars on the compile classpath are compiled with the rest of the sources

**URL:** <https://discuss.gradle.org/t/sources-included-in-jars-on-the-compile-classpath-are-compiled-with-the-rest-of-the-sources/1524>\
**Category:** Old Forum Archive\
**Created:** [June 11, 2014, 11:39pm UTC](https://discuss.gradle.org/t/sources-included-in-jars-on-the-compile-classpath-are-compiled-with-the-rest-of-the-sources/1524 "2014-06-11T23:39:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wayne\_Rasmuss](https://avatars.discourse-cdn.com/v4/letter/w/96bed5/32.png) [@Wayne\_Rasmuss](https://discuss.gradle.org/u/Wayne_Rasmuss)\
**Post date:** [June 11, 2014, 11:39pm UTC](https://discuss.gradle.org/t/sources-included-in-jars-on-the-compile-classpath-are-compiled-with-the-rest-of-the-sources/1524/1 "2014-06-11T23:39:00Z")

</div>

This is due to a quirk of the java compiler See below from Oracle’s javac documentation

"\>If the -sourcepath option is not specified, the user class path is also searched for source files. "

if the compileJava task had the equivalent of the below code added by default, this would not happen.

compileJava.options.compilerArgs += “-sourcepath” compileJava.options.compilerArgs += “”

I can’t think of anytime I would want sources included with classpath jars compiled in with the rest of my code

---

<div class="post-metadata">

**Author:** ![Dan\_Stine](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Dan\_Stine](https://discuss.gradle.org/u/Dan_Stine)\
**Post date:** [June 12, 2014, 1:02pm UTC](https://discuss.gradle.org/t/sources-included-in-jars-on-the-compile-classpath-are-compiled-with-the-rest-of-the-sources/1524/2 "2014-06-12T13:02:00Z")

</div>

Relevant discussion:

[http://gradle.1045684.n5.nabble.com/Proposals-for-Java-compilation-improvements-td5711609.html](http://gradle.1045684.n5.nabble.com/Proposals-for-Java-compilation-improvements-td5711609.html)

[http://forums.gradle.org/gradle/topics/javadoc\_generation\_failed\_with\_vaadin\_dependency](http://forums.gradle.org/gradle/topics/javadoc_generation_failed_with_vaadin_dependency)

---

<div class="post-metadata">

**Author:** ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)\
**Post date:** [June 12, 2014, 1:25pm UTC](https://discuss.gradle.org/t/sources-included-in-jars-on-the-compile-classpath-are-compiled-with-the-rest-of-the-sources/1524/3 "2014-06-12T13:25:00Z")

</div>

Try

```gradle
compileJava.options.compilerArgs << '-implicit:none'

```

Related discussion [http://forums.gradle.org/gradle/topics/why\_does\_gradle\_extract\_classes\_from\_jar\_dependencies\_into\_build\_classes](http://forums.gradle.org/gradle/topics/why_does_gradle_extract_classes_from_jar_dependencies_into_build_classes)
