You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "cstamas (via GitHub)" <gi...@apache.org> on 2024/10/16 15:35:09 UTC
[PR] Warn when appropriate [maven]
cstamas opened a new pull request, #1810:
URL: https://github.com/apache/maven/pull/1810
First, `rootDirectory` is nullable, CLIng code was not assuming this, fixed.
Second, emit the "no root found" warning ONLY when appropriate (we have a POM in picture).
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-8302] Warn when appropriate [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #1810:
URL: https://github.com/apache/maven/pull/1810#issuecomment-2417573357
Should we create an IT to check the various use cases ?
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-8302] Warn when appropriate [maven]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas merged PR #1810:
URL: https://github.com/apache/maven/pull/1810
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-8302] Warn when appropriate [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #1810:
URL: https://github.com/apache/maven/pull/1810#discussion_r1803404996
##########
maven-cli/src/main/java/org/apache/maven/cling/invoker/Utils.java:
##########
@@ -144,4 +150,37 @@ public static int toPlexusLoggingLevel(Slf4jConfiguration.Level level) {
case ERROR -> Logger.LEVEL_ERROR;
};
}
+
+ @Nullable
+ public static Path findRoot(Path topDirectory) throws ParserException {
+ requireNonNull(topDirectory, "topDirectory");
+ Path rootDirectory = null;
+ for (RootLocator rootLocator : ServiceLoader.load(RootLocator.class).stream()
+ .map(ServiceLoader.Provider::get)
+ .toList()) {
+ rootDirectory = rootLocator.findRoot(topDirectory);
+ if (rootDirectory != null) {
+ break;
+ }
+ }
+ if (rootDirectory != null) {
+ return getCanonicalPath(rootDirectory);
+ }
+ return null;
+ }
+
+ @Nonnull
+ public static Path findMandatoryRoot(Path topDirectory) throws ParserException {
+ requireNonNull(topDirectory, "topDirectory");
+ Path rootDirectory;
+ for (RootLocator rootLocator : ServiceLoader.load(RootLocator.class).stream()
+ .map(ServiceLoader.Provider::get)
+ .toList()) {
+ rootDirectory = rootLocator.findMandatoryRoot(topDirectory);
Review Comment:
In this case, we'll take only the first `RootLocator`, because calling `findMandatoryRoot` should throw an exception if that `RootLocator` cannot find the root. That's not really in line with the `findRoot` (not mandatory above).
Should that be:
```
return Optional.ofNullable(findMandatory(topDirectory)).orElseThrow();
```
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-8302] Warn when appropriate [maven]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #1810:
URL: https://github.com/apache/maven/pull/1810#issuecomment-2418853122
> Should we create an IT to check the various use cases ?
We could, but this is really minimal impact and more "user experience", nothing biggie IMO.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org