Skip to content

Commit

Permalink
Fix interpolation problems on project when not specifying the model
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Mar 9, 2023
1 parent 24783c0 commit 4119137
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main/java/org/apache/maven/shared/filtering/BaseFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,18 @@ private static Interpolator createInterpolator(
interpolator.addValueSource(propertiesValueSource);

if (project != null) {
interpolator.addValueSource(new PrefixedObjectValueSource(projectStartExpressions, project, true) {
@Override
public Object getValue(String expression) {
Object value = super.getValue(expression);
if (value instanceof Optional) {
value = ((Optional) value).orElse(null);
for (Object root : new Object[] {project, project.getModel()}) {
interpolator.addValueSource(new PrefixedObjectValueSource(projectStartExpressions, root, true) {
@Override
public Object getValue(String expression) {
Object value = super.getValue(expression);
if (value instanceof Optional) {
value = ((Optional) value).orElse(null);
}
return value;
}
return value;
}
});
});
}
}

if (mavenSession != null) {
Expand Down

0 comments on commit 4119137

Please sign in to comment.