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