You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slachiewicz (via GitHub)" <gi...@apache.org> on 2026/09/30 17:06:26 UTC
[PR] [MDEP-969] Replace maven-dependency-tree with Maven Resolver [maven-dependency-plugin]
slachiewicz opened a new pull request, #1712:
URL: https://github.com/apache/maven-dependency-plugin/pull/1712
`dependency:tree` builds its tree from `ProjectDependenciesResolver` (default) and from `RepositorySystem.collectDependencies` with verbose conflict resolution and dependency management (`-Dverbose`), through a small plugin-internal node model; maven-dependency-tree is dropped. Part of retiring maven-dependency-tree, apache/maven-dependency-tree#150.
Fixes #1479.
Verified: `dependency:tree` in every output type, with and without `-Dverbose`, plus scope/includes/excludes variants, on this plugin, maven-resolver-ant-tasks, maven-doxia and maven-surefire (64 outputs) → identical to master, except graphml/tgf node ids, which are identity hashes and change on every run; `mvn verify -P run-its` → 435 tests, 102 ITs, same as master. Only run on Maven 3.9.x.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-969] Replace maven-dependency-tree with Maven Resolver [maven-dependency-plugin]
Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on code in PR #1712:
URL: https://github.com/apache/maven-dependency-plugin/pull/1712#discussion_r4149831961
##########
src/main/java/org/apache/maven/plugins/dependency/tree/VerboseJavaScopeSelector.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.dependency.tree;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.aether.RepositoryException;
+import org.eclipse.aether.util.graph.transformer.ConflictResolver.ConflictContext;
+import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeSelector;
+import org.eclipse.aether.util.graph.transformer.JavaScopeSelector;
+
+/**
+ * Selects the scope like Maven does and records on the winning node a wider scope that was not applied, so the verbose
+ * tree can report it.
+ */
+class VerboseJavaScopeSelector extends ScopeSelector {
+ static final String REDUCED_SCOPE = "REDUCED_SCOPE";
+
+ private static final List<String> ORDERED_SCOPES = Arrays.asList("compile", "runtime", "provided", "test");
+
+ private final ScopeSelector scopeSelector = new JavaScopeSelector();
+
+ @Override
+ public void selectScope(ConflictContext context) throws RepositoryException {
+ scopeSelector.selectScope(context);
+
+ context.getItems().stream()
+ .flatMap(i -> i.getScopes().stream())
+ .distinct()
+ .max(Comparator.comparingInt((String s) -> ORDERED_SCOPES.indexOf(s))
+ .reversed())
+ .filter(s -> s != context.getScope())
Review Comment:
This carries over a reference comparison on strings from `maven-dependency-tree`:
```java
.filter(s -> s != context.getScope())
```
It happens to work only because the resolver usually hands back the same `String` instance that came out of `getItems()`. The intent is `!s.equals(context.getScope())`. Now that the plugin owns the class, this seems like the right moment to fix it — the change can only remove spurious `scope not updated to …` entries, never add any.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-969] Replace maven-dependency-tree with Maven Resolver [maven-dependency-plugin]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #1712:
URL: https://github.com/apache/maven-dependency-plugin/pull/1712#issuecomment-5952109398
Cool!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-969] Replace maven-dependency-tree with Maven Resolver [maven-dependency-plugin]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz merged PR #1712:
URL: https://github.com/apache/maven-dependency-plugin/pull/1712
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org