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


(Wayne Rasmuss) #1

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


(Dan Stine) #2

Relevant discussion:

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


(uklance) #3

Try

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

Related discussion http://forums.gradle.org/gradle/topics/why_does_gradle_extract_classes_from_jar_dependencies_into_build_classes