Skip to content

Use explicit Gradle project dependency notation and test on Gradle 9.6.1#903

Merged
jormundur00 merged 2 commits into
graalvm:masterfrom
jormundur00:fix/gradle-project-dependency-notation
Jul 3, 2026
Merged

Use explicit Gradle project dependency notation and test on Gradle 9.6.1#903
jormundur00 merged 2 commits into
graalvm:masterfrom
jormundur00:fix/gradle-project-dependency-notation

Conversation

@jormundur00

@jormundur00 jormundur00 commented Jun 1, 2026

Copy link
Copy Markdown
Member

Fixes #900

What changed

This PR updates the Gradle plugin to stop using deprecated raw Project dependency notation when wiring its native compile-only configuration.

It also bumps the Gradle functional-test matrix to include 9.6.1 in the normal functionalTest lane so PR CI exercises the regression on a Gradle version that actually emits the deprecation.

Before this change, newer Gradle versions could report a deprecation warning for this dependency notation, and builds that treat warnings as failures could trip over it.

After this change, the plugin uses explicit project path notation instead, and the regression coverage runs on Gradle 9.6.1 with --warning-mode=fail.

Why

This removes a Gradle deprecation path and keeps the plugin compatible with stricter warning handling on newer Gradle versions.

The matrix bump is included because the new regression only becomes meaningful on Gradle 9.6+; without that lane, reduced PR CI would still run the class on 9.0.0 and would not prove the fix.

Example

Before:

On Gradle 9.6.1, running the functional test path with --warning-mode=fail could fail on the deprecated dependency notation path.

After:

The same path uses explicit project dependency notation and no longer triggers that deprecation warning.

Implementation summary

  • Replace the deprecated raw Project dependency notation with explicit project path notation in the native compile-only configuration.
  • Add a Gradle 9.6+ regression test that runs help --warning-mode=fail.
  • Add 9.6.1 to the normal Gradle functional-test matrix, while leaving the config-cache matrix unchanged.
  • Update the declared tested Gradle versions in the support-matrix spec.

Validation

  • JAVA_HOME=$HOME/.sdkman/candidates/java/17.0.12-graal ./gradlew :native-gradle-plugin:functionalTest -DgradleVersion=9.6.1 --tests 'org.graalvm.buildtools.gradle.JavaApplicationFunctionalTest.does not use deprecated Project dependency notation'
  • JAVA_HOME=$HOME/.sdkman/candidates/java/17.0.12-graal ./gradlew -PmatrixType=gradle :native-gradle-plugin:dumpFunctionalTestList

@jormundur00 jormundur00 added the enhancement New feature or request label Jun 1, 2026
@jormundur00 jormundur00 self-assigned this Jun 1, 2026
@jormundur00
jormundur00 requested a review from vjovanov June 1, 2026 13:39
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 1, 2026
@sschuberth

Copy link
Copy Markdown
Contributor

LGTM, any chance to get this officially review and merged?

@vjovanov vjovanov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

The production change looks correct and complete:

  • dependencies.create(project)dependencies.project(path: project.getPath()) is behaviorally equivalent: same self-project dependency with an absolute, build-local path, and nothing downstream depends on the declared dependency object's type (consumers only use resolved files/components).
  • This was the only raw-Project notation site in the repo, so #900 is fully addressed.
  • The map-based DependencyHandler.project() notation is the right choice for the plugin's Gradle 8.3+ floor — DependencyFactory#create(Project) is itself deprecated, and DependencyFactory#createProjectDependency(String) only exists since Gradle 9.5.

One issue with the test

The new regression test never exercises the regression in CI. The "Using a Project object as a dependency notation" nag was introduced in Gradle 9.6, but the CI functional-test matrix is ["current" (wrapper 8.3), "8.4", "8.14.2", "9.0.0"] (build-logic/.../github-actions-helper.gradle). No matrix version emits the nag, so the test passes identically with the old and the new code — it doesn't guard against reintroducing the bug. (The PR description's own repro had to pass -DgradleVersion=9.6.0-rc-1 explicitly.)

Suggestions:

  1. Add a Gradle ≥ 9.6 version to the functional-test matrix so the test actually bites, and/or
  2. Gate the test with the file's established @Requires-on-gradleVersion idiom (as used elsewhere in JavaApplicationFunctionalTest) to make explicit which versions it applies to.

One thing to be deliberate about: once the matrix includes ≥ 9.6, --warning-mode=fail will fail this test on any deprecation the plugin or the sample triggers on that version, not just this one.

Other angles checked and found fine: config-cache double-run (first uncached run still catches the nag), subproject path resolution (getPath() is absolute; multi-project-with-tests covers subprojects), and the Collections.singletonMap / tasks { succeeded ':help' } style, which matches existing conventions.

@jormundur00
jormundur00 force-pushed the fix/gradle-project-dependency-notation branch from 47ff9f5 to 4664016 Compare July 2, 2026 12:51
@jormundur00 jormundur00 changed the title Use explicit Gradle project dependency notation Use explicit Gradle project dependency notation and test on Gradle 9.6.1 Jul 3, 2026
@jormundur00

Copy link
Copy Markdown
Member Author

Replying to #903 (review)

Addressed this.

I added 9.6.1 to the normal Gradle functional-test matrix, left the config-cache matrix unchanged, and gated the regression in JavaApplicationFunctionalTest to Gradle >= 9.6 so the applicable version range is explicit.

I also updated the support-matrix spec to include the added tested Gradle version.

The latest PR CI for commit 4664016b79c5d8f8a48e9c79f2e3435ba812dae3 ran the JavaApplicationFunctionalTest lane on Gradle 9.6.1 successfully, so the regression is now exercised in PR CI.

@jormundur00
jormundur00 merged commit 4bdb360 into graalvm:master Jul 3, 2026
32 checks passed
pull Bot pushed a commit to pdibenedetto/spring-boot that referenced this pull request Jul 14, 2026
This commit also suppresses new warnings from the Native Build Tools
Plugin, see graalvm/native-build-tools#903

Closes spring-projectsgh-50793
mergify Bot added a commit to robfrank/linklift that referenced this pull request Jul 17, 2026
….2 to 1.1.4 [skip ci]

Bumps [org.graalvm.buildtools:native-maven-plugin](https://github.com/graalvm/native-build-tools) from 1.1.2 to 1.1.4.
Release notes

*Sourced from [org.graalvm.buildtools:native-maven-plugin's releases](https://github.com/graalvm/native-build-tools/releases).*

> 1.1.4
> -----
>
> What's Changed
> --------------
>
> * Release 1.1.3 by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#944](https://redirect.github.com/graalvm/native-build-tools/pull/944)
> * Bump version to 1.1.4-SNAPSHOT by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#946](https://redirect.github.com/graalvm/native-build-tools/pull/946)
> * Re-enable layered application functional test by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#904](https://redirect.github.com/graalvm/native-build-tools/pull/904)
> * Fix Gradle system property quoting by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#907](https://redirect.github.com/graalvm/native-build-tools/pull/907)
> * Avoid disabled agent instrumentation by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#905](https://redirect.github.com/graalvm/native-build-tools/pull/905)
> * Use systemPropertyVariables for Maven test plugin injection by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#902](https://redirect.github.com/graalvm/native-build-tools/pull/902)
> * Improve missing metadata reporting for newer repository releases by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#948](https://redirect.github.com/graalvm/native-build-tools/pull/948)
> * Fix invalid Gradle tracing-agent grund citation by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#950](https://redirect.github.com/graalvm/native-build-tools/pull/950)
> * Use explicit Gradle project dependency notation and test on Gradle 9.6.1 by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#903](https://redirect.github.com/graalvm/native-build-tools/pull/903)
> * Migrate functional CI to GraalVM for JDK 25 by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#953](https://redirect.github.com/graalvm/native-build-tools/pull/953)
> * Add Maven plugin inspections to CI by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#911](https://redirect.github.com/graalvm/native-build-tools/pull/911)
> * Add common utils CI gate by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#912](https://redirect.github.com/graalvm/native-build-tools/pull/912)
> * Fix Maven metadata repository fallback mutation by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#914](https://redirect.github.com/graalvm/native-build-tools/pull/914)
> * Add regression tests for Windows args-file paths by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#915](https://redirect.github.com/graalvm/native-build-tools/pull/915)
> * Update reachability metadata to 1.0.5 by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#962](https://redirect.github.com/graalvm/native-build-tools/pull/962)
>
> **Full Changelog**: <graalvm/native-build-tools@1.1.3...1.1.4>
>
> 1.1.3
> -----
>
> What's Changed
> --------------
>
> * Release 1.1.2 by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#923](https://redirect.github.com/graalvm/native-build-tools/pull/923)
> * Bump version to 1.1.3-SNAPSHOT by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#924](https://redirect.github.com/graalvm/native-build-tools/pull/924)
> * Bump io.netty:netty-codec-http from 4.1.132.Final to 4.1.135.Final in /samples/metadata-repo-integration by [`@​dependabot`](https://github.com/dependabot)[bot] in [graalvm/native-build-tools#932](https://redirect.github.com/graalvm/native-build-tools/pull/932)
> * Refine grund specification by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#917](https://redirect.github.com/graalvm/native-build-tools/pull/917)
>
> **Full Changelog**: <graalvm/native-build-tools@1.1.2...1.1.3>


Commits

* [`68c8e9f`](graalvm/native-build-tools@68c8e9f) Release 1.1.4
* [`a38531d`](graalvm/native-build-tools@a38531d) Merge pull request [#962](https://redirect.github.com/graalvm/native-build-tools/issues/962) from graalvm/update-metadata-to-1.0.5
* [`3073b19`](graalvm/native-build-tools@3073b19) Update reachability metadata to 1.0.5
* [`6a4139f`](graalvm/native-build-tools@6a4139f) Add regression tests for Windows args-file paths ([#915](https://redirect.github.com/graalvm/native-build-tools/issues/915))
* [`128dd2c`](graalvm/native-build-tools@128dd2c) Fix Maven metadata repository fallback mutation ([#914](https://redirect.github.com/graalvm/native-build-tools/issues/914))
* [`12ebca4`](graalvm/native-build-tools@12ebca4) Add common utils CI gate ([#912](https://redirect.github.com/graalvm/native-build-tools/issues/912))
* [`609bc14`](graalvm/native-build-tools@609bc14) Add Maven plugin inspections to CI ([#911](https://redirect.github.com/graalvm/native-build-tools/issues/911))
* [`52a30b1`](graalvm/native-build-tools@52a30b1) Migrate functional CI to GraalVM for JDK 25 ([#953](https://redirect.github.com/graalvm/native-build-tools/issues/953))
* [`4bdb360`](graalvm/native-build-tools@4bdb360) Use explicit Gradle project dependency notation and test on Gradle 9.6.1 ([#903](https://redirect.github.com/graalvm/native-build-tools/issues/903))
* [`fb710bb`](graalvm/native-build-tools@fb710bb) Fix invalid Gradle tracing-agent grund citation ([#950](https://redirect.github.com/graalvm/native-build-tools/issues/950))
* Additional commits viewable in [compare view](graalvm/native-build-tools@1.1.2...1.1.4)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.graalvm.buildtools:native-maven-plugin&package-manager=maven&previous-version=1.1.2&new-version=1.1.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEAT: Gradle 9.6: Do not pass a Project object directly as a dependency notation

3 participants