Why does Gradle extract classes from Jar dependencies into build/classes?

Recently I looked into one of the Gradle built jars of my projects and found that the jar contained classes from some external dependencies. Looking into the build/classes directory, I saw that it contained extracted classes from those external dependencies. Curiously, these extracted classes can also be found in some other projects build/classes directories, and they come only from two of a multitude of dependent jars.

One of the exploded jars is log4j.jar, and this dependency I declared globally in my root build.gradle in the subproject definition. So, while this dependency is declared for all subprojects, I can find the exploded classes from it only in some subprojects (24 of 89 projects) build/classes directory. Another curious thing: not all classes are exploded and their count is different in different the build/classes directories.

I cannot figure out what might cause this behavior. If I call gradle with the --debug option, I cannot discover anything what might be an explanation. Any ideas?

(btw: I’rm running Gradle 1.11)

This rings a bell.

I’m guessing that the log4j.jar file has .java source code in it. I think you can pass

-implicit:none

To the compiler so that these files aren’t compiled.

eg:

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

More info: http://forums.gradle.org/gradle/topics/when_why_does_gradle_extract_class_files_from_dependencies_to_build_classes http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html#implicit

5 stars to Lance!!!

Indeed, your bells gave the right sounds. And I could solve my problem. Thanks very much.