[MNG-8288] "path cannot be null" (#1782)

It seems Maven is eager to get POM from rootDirectory to support
CI Friendly versions. This change makes it "best effort", as in
if there is no POM, just walk away.

---

https://issues.apache.org/jira/browse/MNG-8288
This commit is contained in:
Tamas Cservenak 2024-10-07 14:19:01 +02:00 committed by GitHub
parent 165588cbda
commit b2b868f864
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -1328,9 +1328,12 @@ public class DefaultModelBuilder implements ModelBuilder {
// defined on the root project.
Map<String, String> properties = new HashMap<>();
if (!Objects.equals(rootDirectory, model.getProjectDirectory())) {
Model rootModel = derive(ModelSource.fromPath(modelProcessor.locateExistingPom(rootDirectory)))
.readFileModel();
properties.putAll(rootModel.getProperties());
Path rootModelPath = modelProcessor.locateExistingPom(rootDirectory);
if (rootModelPath != null) {
Model rootModel =
derive(ModelSource.fromPath(rootModelPath)).readFileModel();
properties.putAll(rootModel.getProperties());
}
} else {
properties.putAll(model.getProperties());
}