sdedic commented on code in PR #8057:
URL: https://github.com/apache/netbeans/pull/8057#discussion_r1894612526
##########
java/maven/src/org/netbeans/modules/maven/api/PluginPropertyUtils.java:
##########
@@ -658,47 +658,36 @@ public List<Dependency> build(Xpp3Dom configRoot,
ExpressionEvaluator eval) {
item.setLocation(PROP_GROUP_ID,
(InputLocation)g.getInputLocation());
}
- Dependency dependencyFromDependencyManagement = null;
- if(dependencyManagement != null &&
dependencyManagement.getDependencies() != null) {
- dependencyFromDependencyManagement =
- dependencyManagement
+ if (v != null) {
+ item.setVersion(v.getValue());
+ item.setLocation(PROP_VERSION,
(InputLocation)v.getInputLocation());
+ } else if (dependencyManagement != null &&
dependencyManagement.getDependencies() != null) {
+ dependencyManagement
.getDependencies()
.stream()
.filter(d -> {
return Objects.equals(item.getGroupId(),
d.getGroupId())
- &&
Objects.equals(item.getArtifactId(), d.getArtifactId());
+ &&
Objects.equals(item.getArtifactId(), d.getArtifactId())
+ &&
Objects.equals(item.getClassifier(), d.getClassifier())
+ && Objects.equals(item.getType(),
d.getType());
Review Comment:
Apologies for unclear wording; maybe code would help to understand the
intent/difference:
```
if (item.getVersion() == null || item.getScope() == null) {
String defaultType = "jar"; // PENDING: this could be an
optional parameter
if (dependencyManagement != null &&
dependencyManagement.getDependencies() != null) {
dependencyManagement
.getDependencies()
.stream()
.filter(d -> {
return Objects.equals(item.getGroupId(),
d.getGroupId())
&&
Objects.equals(item.getArtifactId(), d.getArtifactId())
&&
Objects.equals(item.getClassifier(), d.getClassifier())
&& Objects.equals(item.getType()
!= null ? item.getType() : defaultType, d.getType());
})
.findFirst()
.ifPresent(d -> {
if (item.getVersion() == null) {
item.setVersion(d.getVersion());
item.setLocation(PROP_VERSION,
d.getLocation(PROP_VERSION));
}
if (item.getScope() == null) {
item.setVersion(d.getScope());
item.setLocation(PROP_SCOPE,
d.getLocation(PROP_SCOPE));
}
});
}
```
- in order for dependency-management to match,
group:artifact:classifierOpt:typeOpt have to be the same
- type defaults to `jar` if not specified in the `dependency` (assuming the
dep mgmt has type resolved before this code executes ? not sure about this)
- on match, missing version/scope is supplied from dependency managament
What do you think ?
--
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