RFR: 8333146: Move maven publication logic from build.gradle [v4]
Marius Hanl
mhanl at openjdk.org
Sun Nov 16 11:14:10 UTC 2025
> 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 register all modules for publication.
>
> This way, the only thing that the `build.gradle` will do is to apply `maven-publish.gradle` as plugin after all projects are defined.
>
> This will reduce the size by ~170 lines for the `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:
> -> Example: 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`, the deprecated `project.task` method 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.
> Note2: I did a small improvement to the `addMavenPublication` method. It is now more 'typesafe', e.g. projects must be passed in directly, not as String. If a project does not exist, the build will fail with an exception.
Marius Hanl has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
- Merge branch 'master' of https://github.com/openjdk/jfx into 833146-mvn-publish
- remove print
- Use projects directly
- Further reduce coupling between main build.gradle and maven-publish.gradle
- Move MAVEN_GROUP_ID and fail() over to maven-publish.gradle
- Copyright header
- 8333146: Move maven publication logic from build.gradle
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1970/files
- new: https://git.openjdk.org/jfx/pull/1970/files/b465f5e0..ea0b427c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1970&range=03
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1970&range=02-03
Stats: 82 lines in 7 files changed: 56 ins; 8 del; 18 mod
Patch: https://git.openjdk.org/jfx/pull/1970.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1970/head:pull/1970
PR: https://git.openjdk.org/jfx/pull/1970
More information about the openjfx-dev
mailing list