Org.gradle.java.compile-classpath-packaging=true failing to affect class path

In a Gradle 6.1.1 composite build, I added org.gradle.java.compile-classpath-packaging=true to the gradle.properties in the composite and in each included build.

From what I know, that property is supposed to make the classpath of tasks in projects to which JavaLibraryPlugin has been applied include the jar file output, instead of the built classes directory output, of other projects.

This doesn’t seem to have worked for me, however, because the dependent included build in my case had the following path in its JavaCompile#classpath:

~/Code/project1/common/build/classes/java/main

Am I mistaken about what that property should do? Is there some way that my configuration might be amiss?

To note: JavaLibraryPlugin was not applied to my composite (as the composite doesn’t include any code itself; it’s just a way to combine other builds together), but it was applied to all the relevant included builds (by another included build that is itself a Gradle plugin that applies JavaLibraryPlugin & performs some other configuration).

Once I’ve sorted out JavaCompile, are there any other tasks that the property should affect? e.g., JavaExec tasks?

Thanks for any help.

It’s quite old issue, but for those who also have this problem:
add systemProp.org.gradle.java.compile-classpath-packaging=true to your gradle.properties.

As stated in Build Environment " You can also set system properties in gradle.properties files with the prefix systemProp."

You can also pass it via command line using -Dorg.gradle.java.compile-classpath-packaging=true.

1 Like