You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "matthiasblaesing (via GitHub)" <gi...@apache.org> on 2023/09/26 19:28:56 UTC
[GitHub] [netbeans] matthiasblaesing commented on a diff in pull request #6493: UpdateDependencyHint should work on plugins with default maven group id
matthiasblaesing commented on code in PR #6493:
URL: https://github.com/apache/netbeans/pull/6493#discussion_r1337684496
##########
java/maven.hints/src/org/netbeans/modules/maven/hints/pom/UpdateDependencyHint.java:
##########
@@ -109,10 +110,15 @@ private void addHintsTo(List<? extends VersionablePOMComponent> components, Map<
for (VersionablePOMComponent comp : components) {
- String groupId = comp.getGroupId();
- String artifactId = comp.getArtifactId();
+ String groupId = comp.getGroupId() != null && !comp.getGroupId().isBlank() ? comp.getGroupId() : null;
+ String artifactId = comp.getArtifactId() != null && !comp.getArtifactId().isBlank() ? comp.getArtifactId() : null;
- if (groupId != null && artifactId != null && !groupId.isEmpty() && !artifactId.isEmpty()) {
+ // no group ID could indicate it is a default maven plugin
+ if (comp instanceof Plugin && groupId == null && artifactId != null && artifactId.startsWith("maven-")) {
Review Comment:
The XSD is pretty definitive here. If not specified, the groupId defaults to `org.apache.maven.plugins` for `Plugin` and `ReportPlugin` types. So I suggest to simplify to:
```suggestion
if ((comp instanceof Plugin || comp instanceof ReportPlugin) && groupId == null) {
```
This makes me suggest to add the after the handling of the build plugins in `getErrorsForDocument`:
```java
Reporting reporting = model.getProject().getReporting();
if(reporting != null) {
if (reporting.getReportPlugins() != null) {
addHintsTo(reporting.getReportPlugins(), hints);
}
}
```
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists