matthiasblaesing commented on code in PR #8057:
URL: https://github.com/apache/netbeans/pull/8057#discussion_r1885906117
##########
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:
You are right. I had a different use-case in mind, but that is not covered:
https://github.com/apache/maven-compiler-plugin/blob/46b207b6fb4df8fdbc1188896e5245047324d925/src/main/java/org/apache/maven/plugin/compiler/DependencyCoordinate.java#L118-L126
This might be handled differently in other plugins, but for now I adjusted
the code accordingly. Pushed an update.
--
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