Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #8764 Gradle 9 ProjectDependency resolution to other project#8797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mbien merged 1 commit intoapache:masterfromwrprice:issue8764
Sep 10, 2025

Conversation

@wrprice
Copy link
Contributor

@wrpricewrprice commentedSep 7, 2025
edited by mbien
Loading

In multi-project Gradle builds where one project depends on another project, for example:

implementation project(':otherProject')

The dependency is represented in the Gradle API as aProjectDependency object, butProjectDependency::getDependencyProject was deprecated, and then removed in Gradle 9.0.0. When using Gradle >= 9, it now requires two steps to resolve target of the dependency:

  1. Use reflection to accessProjectDependency::getPath (added in Gradle 8.11)
  2. Resolve the target project usingProject::findProject(String path)

fixes#8764


^Add meaningful description above

Click to collapse/expand PR instructions

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg.git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

PR approval and merge checklist:

  1. Was this PRcorrectly labeled, did the right tests run? When did they run?
  2. Is this PRsquashed?
  3. Are author name / email address correct? Areco-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch:don't merge. (full wiki article)

mbien reacted with thumbs up emoji
@mbienmbien added Gradle[ci] enable "build tools" tests ci:dev-build[ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labelsSep 7, 2025
Comment on lines +1567 to +1581
Function<ProjectDependency,Project>projDependencyToProject =
sinceGradleOrDefault(
"9.0",
() -> {
MethodgetPath =ProjectDependency.class.getMethod("getPath");
returndep -> {
try {
Stringpath = (String)getPath.invoke(dep);
returnproject.findProject(path);
}catch (ReflectiveOperationExceptione) {
thrownewUnsupportedOperationException(e);
}
};
},
() ->ProjectDependency::getDependencyProject);// removed in Gradle 9
Copy link
Member

Choose a reason for hiding this comment

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

IMO: this would be more future proof if we would call the new method directly and use reflection for the removed method. (basically the other way around)

@lkishalmi@sdedic do you think we can bump the gradle tooling version of this module so that we can callgetPath() directly?

Copy link
ContributorAuthor

@wrpricewrpriceSep 7, 2025
edited
Loading

Choose a reason for hiding this comment

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

Gradle >= 8.11 but <9 should have both APIs

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I have an alternative branch where I think I've done the necessary work to bump this module up to Gradle 8.11.1. Tested locally on some personal Gradle projects using 7.5.x, 8.11-14, and 9.0.0 and they all open w/out error notifications. In the process there was a fun roadbump that turns out to be a JDK bug re: method references under certain conditions.

The 8.11.1 upgrade has several more required changes compared to this spot fix. LMK how you'd like me to proceed.

Copy link
Member

Choose a reason for hiding this comment

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

@wrprice sounds great! We could try to get this PR here in first, then see if we can bump the tooling version.

Last time I tried I could get a hello world project using gradle 5.x to build, but I believe 4 didn't work anymore. But I personally don't use gradle all that much, I let others comment on the versions question. NB generally tries to support lower versions if it is still reasonably maintainable while keeping up with latest releases.

The 8.11.1 upgrade has several more required changes compared to this spot fix. LMK how you'd like me to proceed.

Once this PR here is merged, we could certainly take a look at the version bump proposal, unless there is a showstopper I am not aware of (cc@lkishalmi )

@mbienmbien added this to theNB28 milestoneSep 7, 2025
@mbien
Copy link
Member

looks like the paperwork check doesn't like the commit header. The reason for that is because github added thenoreply mail which isn't a valid address. Its agithub settings.

Assuming your localgit log has the right email address on the commit, you will likely still have to make a change to this PR for the new setting to take effect. Feel free to do agit pull --rebase https://github.com/apache/netbeans master and then simply force push into your branch.

You can see if it is worked by looking at the patch file for this PR:

https://github.com/apache/netbeans/pull/8797.patch

wrprice reacted with thumbs up emoji

@wrpricewrprice marked this pull request as ready for reviewSeptember 10, 2025 03:51
Copy link
Member

@mbienmbien left a comment

Choose a reason for hiding this comment

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

changes look good to me, CI is happy too

@mbienmbien merged commitd10bf81 intoapache:masterSep 10, 2025
32 checks passed
@mbien
Copy link
Member

@wrprice thanks for the fix and congrats on your first contribution!

wrprice reacted with hooray emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mbienmbienmbien approved these changes

Assignees

No one assigned

Labels

ci:dev-build[ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page)Gradle[ci] enable "build tools" tests

Projects

None yet

Milestone

NB28

Development

Successfully merging this pull request may close these issues.

NetBeans 27 gives error with Gradle 9 web project

2 participants

@wrprice@mbien

[8]ページ先頭

©2009-2025 Movatter.jp