Skip to content

Commit

Permalink
Optionally resolve properties in yaml (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Feb 20, 2024
1 parent 25268ad commit a3cf901
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/openrewrite/maven/AbstractRewriteMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public abstract class AbstractRewriteMojo extends ConfigurableRewriteMojo {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
protected MavenProject project;

@Parameter(property = "rewrite.resolvePropertiesInYaml", defaultValue = "true")
protected boolean resolvePropertiesInYaml;

@Component
protected RuntimeInformation runtime;

Expand Down Expand Up @@ -127,7 +130,8 @@ protected Environment environment(@Nullable ClassLoader recipeClassLoader) throw
Config rewriteConfig = getConfig();
if (rewriteConfig != null) {
try (InputStream is = rewriteConfig.inputStream) {
env.load(new YamlResourceLoader(is, rewriteConfig.uri, project.getProperties()));
Properties propertiesToResolve = resolvePropertiesInYaml ? project.getProperties() : new Properties();
env.load(new YamlResourceLoader(is, rewriteConfig.uri, propertiesToResolve));
}
}
} catch (IOException e) {
Expand Down

0 comments on commit a3cf901

Please sign in to comment.