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:

(uklance) #3


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

Related discussion