Skip to content

Build the Maven dependency tree with Maven Resolver instead of maven-dependency-tree - #9694

Merged
mbien merged 1 commit into
apache:masterfrom
slachiewicz:maven-drop-dependency-tree
Nov 23, 2026
Merged

mbien merged 1 commit into
apache:masterfrom
slachiewicz:maven-drop-dependency-tree

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

DependencyTreeFactory still built trees with maven-dependency-tree 2.2 (2014), whose DependencyTreeBuilder goes through maven-compat's legacy ArtifactCollector — the TODO: check alternative for deprecated maven components in that class. This replaces it with Maven Resolver's own verbose collection and drops the bundled jar.

  • DependencyTreeFactory collects the project's dependencies with ConflictResolver in verbose mode, using a session from the new MavenEmbedder.newRepositorySession() (settings, mirrors, workspace reader, offline flag).
  • The result is a NetBeans-owned org.netbeans.modules.maven.embedder.tree.DependencyNode and DependencyNodeVisitor, keeping the part of the old API NetBeans uses, so the 15 classes in maven, maven.graph and maven.repository only change imports.
  • Mapping: winners are INCLUDED; a loser whose winner is an ancestor is OMITTED_FOR_CYCLE; same base version as the winner is OMITTED_FOR_DUPLICATE; otherwise OMITTED_FOR_CONFLICT, with the winner as related artifact.

Behaviour differences:

  • Resolver removes cycle losers even in verbose mode, so OMITTED_FOR_CYCLE is effectively never produced.
  • The scope filter now prunes subtrees; the old builder accepted a filter but never applied it.
  • Nodes use identity equality, so lookups no longer break when a node's hash changes after mutation.

Compatibility: maven.embedder goes to 2.90 and no longer exports org.apache.maven.shared.dependency.{tree,tree.traversal,graph,graph.filter,graph.traversal} to friends. That is incompatible for any friend module compiling against those packages. None of the external friends in project.xml uses them: GitHub code search finds no reference in jeddict (jeddict-modeler, jeddict-extensions), sqe-team/sqe, vaadin/netbeans-plugin (archived), NbAppEngine or the netbeans-contrib selenium module. apisupport.installer.maven and maven.util are former NetBeans modules no longer in the tree, and jbi.fuji.support and android.maven have no public source. The change is recorded in apichanges.xml.

apichanges.xml now uses apichanges-1.1.dtd, whose year list already covers 2026.

Not tested manually in a running IDE (dependency graph, exclude dependency, create library dialogs).

Verified: ant -f java/maven.embedder test → DependencyTreeFactoryTest 5/5 and the existing embedder tests green; ant -f java/maven test → 418 tests, 0 failures; ant -Dcluster.config=java verify-libs-and-licenses → 0 failures.

Assisted-by: Claude Opus 5.5

@slachiewicz slachiewicz mentioned this pull request Oct 9, 2026
4 of 5 tasks
@mbien mbien added Maven [ci] enable "build tools" tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Oct 9, 2026
@apache apache locked and limited conversation to collaborators Oct 9, 2026
@apache apache unlocked this conversation Oct 9, 2026
Comment thread nbbuild/javadoctools/apichanges.dtd Resolved
@mbien

mbien commented Oct 10, 2026

Copy link
Copy Markdown
Member

checked a few friend packages I could still find

inactive:

active, but no DependencyNode usage used as needle

most of the other stuff looks like modules within this repo (some of it doesn't exist anymore too, e.g org.netbeans.modules.apisupport.installer.maven)

-> we should be fine

@slachiewicz
slachiewicz force-pushed the maven-drop-dependency-tree branch from 0dc1381 to dfe9dca Compare October 12, 2026 09:45
@slachiewicz

Copy link
Copy Markdown
Member Author

Switched apichanges.xml to apichanges-1.1.dtd and dropped the DTD change. The description now has the friends research: none of the external friends uses the dropped org.apache.maven.shared.dependency.* packages. That covers jeddict (jeddict-modeler, jeddict-extensions), sqe, the archived vaadin plugin, NbAppEngine and the netbeans-contrib selenium module. apisupport.installer.maven and maven.util no longer exist, and jbi.fuji.support and android.maven have no public source.

@slachiewicz

Copy link
Copy Markdown
Member Author

Can't believe it's green. Or too early to celebrate?

@mbien

mbien commented Oct 13, 2026

Copy link
Copy Markdown
Member

Can't believe it's green. Or too early to celebrate?

its a good sign from the CI gremlins! Some of the CI jobs are a bit brittle and need restarts, so a single failure wouldn't necessarily mean its a regression.

We would create the release branches for NB 32 this week (~15th). I think #9642 has a small chance to make it still in - mostly because its not clear if anyone tested it beside me. Putting NB 33 milestone on this PR here.

Thanks a lot for helping with this btw!

@mbien mbien added this to the NB33 milestone Oct 13, 2026
@slachiewicz

Copy link
Copy Markdown
Member Author

We would create the release branches for NB 32 this week (~15th). I think #9642 has a small chance to make it still in - mostly because its not clear if anyone tested it beside me. Putting NB 33 milestone on this PR here.

To early with 3.10 yet. Wait for few more patch releases - i'll take look next week to report/fix issues with upgrade

@mbien

mbien commented Nov 21, 2026

Copy link
Copy Markdown
Member

@slachiewicz we might have to bump a few versions due to the API change. Its less important due to it being friend deps but it doesn't hurt.

I added a commit, feel free to squash it with your changes:
branch: https://github.com/mbien/netbeans/commits/maven-drop-dependency-tree/
commit: mbien@ea6717b

@mbien

mbien commented Nov 22, 2026

Copy link
Copy Markdown
Member

(also let me know if you want me to take over this PR, i can squash the changes into your commit)

@slachiewicz

Copy link
Copy Markdown
Member Author

I'm ok, if all works it's ready for final review.

@mbien

mbien commented Nov 23, 2026

Copy link
Copy Markdown
Member

cool. will rebase ontop of latest master (+fix conflicts) and squash both commits into one + force push. If everything is green again i think we can get this in. I tested it manually already.

…dependency-tree

DependencyTreeFactory now collects the project graph with the Maven Resolver
conflict resolver in verbose mode and returns a NetBeans-owned DependencyNode,
so the unmaintained maven-dependency-tree 2.2 jar and its friend packages go.

Bump maven.embedder to 3.0 after dropping maven-dependency-tree

Assisted-by: Claude Opus 5.5
@mbien
mbien force-pushed the maven-drop-dependency-tree branch from e728efd to e2e7c56 Compare November 23, 2026 12:36
@ebarboni

Copy link
Copy Markdown
Contributor

LGTM, and as integrated early for nb33 it's safe

@mbien
mbien merged commit 34f0454 into apache:master Nov 23, 2026
31 checks passed
@slachiewicz
slachiewicz deleted the maven-drop-dependency-tree branch November 23, 2026 16:09
@mbien

mbien commented Nov 23, 2026

Copy link
Copy Markdown
Member

@slachiewicz thanks for helping with this and the MVN 3.10 PR too!

@jtulach jtulach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work. Hopefully it works well. From my perspective I am glad to see bump in the implementation version to signal incompatible change in the API. E.g. this seems to be versioned properly. Thanks for the contribution.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants