JDK-8185358 : gradle 4.X has changed location of built classes
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-07-26
  • Updated: 2018-03-06
  • Resolved: 2017-07-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Fixed
Related Reports
Blocks :  
Relates :  
Description
https://docs.gradle.org/current/release-notes.html#location-of-classes-in-the-build-directory documents a breaking change :

The default location of classes when using the java .. plugin has changed from:
Java, `src/main/java` -> build/classes/main
..
to
..
Java, `src/main/java` -> build/classes/java/main

This breaks the FX build.
This change is to support multiple language output locations.
Since we don't need that, the most prudent/safest thing is to
change the output location back to what gradle 3.X used.
This will be compatible with 3.x and so we can use either gradle 3.x
or gradle 4.x
Comments
Changeset: 0c458c14b6b9 Author: prr Date: 2017-07-27 11:56 -0700 URL: http://hg.openjdk.java.net/openjfx/10-dev/rt/rev/0c458c14b6b9 8185358: gradle 4.X has changed location of built classes Reviewed-by: kcr, ddhill ! build.gradle
27-07-2017

I think common might be safer. Some (but not all) of the various modules care where the classes are built, and while I would hope I made most of those use the sourceset for the output dir variable, it would appear I missed some.
27-07-2017

The only question I have is whether the change should be done in commonModuleSetup (which is what the webrev implements), or in the allprojects block right after applying the java plugin. Dave Hill might have an opinion. Either way, this looks fine to me. +1
27-07-2017

diff --git a/build.gradle b/build.gradle --- a/build.gradle +++ b/build.gradle @@ -828,6 +828,8 @@ // perform common project manipulation for modules void commonModuleSetup(Project p, List<String> moduleChain) { + // Allow the build to use either gradle 3.x or gradle 4.x + p.sourceSets.main.output.classesDir = new File(p.buildDir, "classes/main") p.ext.moduleChain = moduleChain if (p.hasProperty("moduleName")) {
26-07-2017