You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "asbachb (via GitHub)" <gi...@apache.org> on 2023/02/14 13:20:49 UTC

[GitHub] [netbeans] asbachb commented on a diff in pull request #5482: Ensure that single thread flag is not set when using `mvnd`

asbachb commented on code in PR #5482:
URL: https://github.com/apache/netbeans/pull/5482#discussion_r1105815002


##########
java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java:
##########
@@ -480,6 +481,18 @@ public void setBinaryDownloadStrategy(DownloadStrategy ds) {
             }
         }
 
+        try {
+            try (Stream<Path> jars = Files.list(lib).filter(file -> file.getFileName().toString().startsWith("maven-core"))) {  // NOI18N
+                for (Path mavenCoreJar : jars.collect(Collectors.toList())) {
+                    String mavenCoreJarName = mavenCoreJar.getFileName().toString();
+                    if (mavenCoreJarName.matches("maven-core-\\d+\\.\\d+\\.\\d+\\.jar")) {
+                        return mavenCoreJarName.replace("maven-core-", "").replace(".jar", "");
+                    }
+                }
+            }
+        } catch (IOException ignored) {
+        }

Review Comment:
   You're definitely right. I guess I took too much from the previous loop/check.
   
   I took your suggestion and modified it a little bit further. I thought it might be better to reuse the `Pattern` if we go this route so I changed to code to extract the version from that `Pattern` as well.
   
   Maybe you can have a second look at the code and open a new suggestion on that part if necessary.



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