RFR: 8333146: Move maven publication logic from build.gradle

Marius Hanl mhanl at openjdk.org
Thu Nov 13 10:09:16 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.

> Note that there's a relevant stale PR in #1232 by @jjohannes. Maybe he'd like to take a look.

Thanks. It looks like my work will not block/interfere the implementation of that PR, which is good. 
It should be easy to pick the changes from there over in the new `maven-publish.gradle`. 
Should also help for reviewing, since it is more isolated. :-)

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1970#issuecomment-3526934812


More information about the openjfx-dev mailing list