gnodet commented on code in PR #1197:
URL: https://github.com/apache/maven/pull/1197#discussion_r1330157270


##########
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java:
##########
@@ -95,8 +114,15 @@ public File locateExistingPom(File projectDirectory) {
 
     public Path locateExistingPom(Path projectDirectory) {
         // Note that the ModelProcessor#locatePom never returns null
-        File f = modelLocator.locateExistingPom(projectDirectory.toFile());
-        Path pom = f != null ? f.toPath() : null;
+        // while the ModelParser#locatePom needs to return an existing path!
+        Path pom = modelParsers.stream()
+                .map(m -> m.locate(projectDirectory).map(s -> 
s.getPath()).orElse(null))
+                .filter(Objects::nonNull)
+                .findFirst()
+                .orElseGet(() -> {
+                    File f = 
modelLocator.locateExistingPom(projectDirectory.toFile());

Review Comment:
   `ModelLocator` is part of the Maven 3 public api and uses the `File` instead 
of `Path`.
   The Maven 4 api uses `Path` and not `File`, but I don't think that's a good 
idea to start modifying the Maven 3 api in incompatible ways, or even to 
duplicate all the methods to leverage the nio API at this point.
   So I'm not really sure what can be done here.



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

Reply via email to