sdedic commented on code in PR #8057:
URL: https://github.com/apache/netbeans/pull/8057#discussion_r1885853659
##########
java/maven/src/org/netbeans/modules/maven/api/PluginPropertyUtils.java:
##########
@@ -652,21 +657,48 @@ public List<Dependency> build(Xpp3Dom configRoot,
ExpressionEvaluator eval) {
item.setGroupId(g.getValue());
item.setLocation(PROP_GROUP_ID,
(InputLocation)g.getInputLocation());
}
+
+ Dependency dependencyFromDependencyManagement = null;
+ if(dependencyManagement != null &&
dependencyManagement.getDependencies() != null) {
+ dependencyFromDependencyManagement =
+ dependencyManagement
+ .getDependencies()
+ .stream()
+ .filter(d -> {
+ return Objects.equals(item.getGroupId(),
d.getGroupId())
+ &&
Objects.equals(item.getArtifactId(), d.getArtifactId());
+ })
+ .findFirst()
+ .orElse(null);
+ }
+
if (v != null) {
item.setVersion(v.getValue());
item.setLocation(PROP_VERSION,
(InputLocation)v.getInputLocation());
+ } else if (dependencyFromDependencyManagement != null) {
+
item.setVersion(dependencyFromDependencyManagement.getVersion());
+ item.setLocation(PROP_VERSION,
dependencyFromDependencyManagement.getLocation(PROP_VERSION));
}
if (c != null) {
item.setClassifier(c.getValue());
item.setLocation(PROP_CLASSIFIER,
(InputLocation)c.getInputLocation());
+ } else if (dependencyFromDependencyManagement != null) {
Review Comment:
I am not sure about this: the `classifier` tags a differnt flavour of an
artifact. So IMHO the dependency mgmt tagged with a classifier does not
apply/manage a project dependency without any classifier (empty classifier).
IMHO group:artifact:classifier:type of the dependency must match the
dependency mgmt decl in order to apply the version from the dependency
management.
So if the dependency mgmt declares a classifier and the artifact does not,
or the dependency mgmt declares a type different from the assumed artifact
type, the management does not apply.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists