matthiasblaesing commented on code in PR #8057:
URL: https://github.com/apache/netbeans/pull/8057#discussion_r1894640712


##########
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:
   Thanks for the update, but I don't think it is necessary. Both sides of the 
comparison are instances of `org.apache.maven.model.Dependency`. That class is 
generated from this:
   
   
https://github.com/apache/maven/blob/maven-3.9.9/maven-model/src/main/mdo/maven.mdo#L1096-L1109
   
   and the decompiler gives me the expected:
   
   
![grafik](https://github.com/user-attachments/assets/b5d61ab6-1ced-40a5-a970-3991a98f4ea6)
   
   The type is `jar` unless overridden. So I don't see how `getType` can return 
null, unless explicitly set from the java side and if not specificied will be 
`jar`.
   
   I moved the version update after the initialization from user input, so that 
we get the Dependency in a state as far initialized as the user did.
   
   I would change/set the scope at least I don't see a use there. For 
dependency resolution I know that
   
   - groupId
   - artifactId
   - version
   - classifier
   - type
   
   take part, I never saw scope, so I would currently not mess with that.
   
   So I think the now pushed version should be safe.



-- 
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

Reply via email to