RFR: 8333146: Move maven publication logic from build.gradle
Kevin Rushforth
kcr at openjdk.org
Fri Nov 14 18:46:38 UTC 2025
On Tue, 11 Nov 2025 08:07:32 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
> This PR splits the maven publishing logic into an own file, `maven-publish.gradle`, that is next to the root `build.gradle`.
>
> The `build.gradle` will apply the `maven-publish.gradle`. The `maven-publish.gradle` will then configure the Maven related properties and provides `addMavenPublication` as `Closure`.
>
> This way, the logic and code can be completely the same. All modules still call `addMavenPublication`, as before.
> https://github.com/openjdk/jfx/blob/013e55b1ba687d212185d00167f375b816faf8c5/build.gradle#L2894-L2898
> But the publishing code and properties itself are out of the main `build.gradle`.
>
> Tested with:
> - `./gradlew -PMAVEN_PUBLISH=true -PMAVEN_VERSION=custom publishToMavenLocal`
> - `./gradlew -PMAVEN_PUBLISH=true publishToMavenLocal`
> - `./gradlew -PMAVEN_PUBLISH=true -PMILESTONE_FCS=true publishToMavenLocal`
>
> Everything still works:
> -> javafx.base from the local .m2 repository
> <img width="1051" height="388" alt="image" src="https://github.com/user-attachments/assets/66ccd007-ff2c-4309-982a-1e8123e9f52a" />
>
> I think this is a good step and an easy way to split out functionality without blowing things up. We might want to do that for other parts as well.
>
> Note: I also fixed the deprecated `buildDir` and 2 warnings where it seems like he might not be able to infer the type (changing `def` to the actual type).
> -> The file is completely green, no warnings or deprecations.
maven-publish.gradle line 1:
> 1: /**
This file should nave a copyright notice, copied from `build.gradle`.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1970#discussion_r2528556096
More information about the openjfx-dev
mailing list