Commit e402269
Support escaping property placeholders with backslash (#6817)
* Support escaping property placeholders in recipe YAML
When recipe YAML contains Maven property references like ${java.version}
in parameter values, the YamlResourceLoader resolves them as property
placeholders at load time. This prevents users from passing literal
${...} references through to recipe parameters.
Add escape support: doubling the first character of the placeholder
prefix (e.g., writing $${java.version} for the ${ prefix) produces
a literal ${java.version} in the resolved output.
Fixes moderneinc/customer-requests#1874
* Support escaping property placeholders in recipe YAML
When recipe YAML contains Maven property references like ${java.version}
in parameter values, the YamlResourceLoader resolves them as property
placeholders at load time. This prevents users from passing literal
${...} references through to recipe parameters.
Add escape support: a backslash before the placeholder prefix (e.g.,
writing \${java.version} for the ${ prefix) produces a literal
${java.version} in the resolved output.
Fixes moderneinc/customer-requests#1874
* Update configuration description and add regression tests
Document the \${...} escape syntax in the ChangePluginConfiguration
@option description so users know how to pass literal Maven property
references.
Add regression tests to ensure existing behavior is preserved:
- Unresolved placeholders are left as-is
- Normal resolution still works
- Backslashes not before a placeholder prefix are preserved
* Add javadoc to replacePlaceholders methods
* Polish
* Regenerate recipes.csv for updated docs; remove duplicates
---------
Co-authored-by: Tim te Beek <tim@moderne.io>1 parent 0abe800 commit e402269
5 files changed
Lines changed: 187 additions & 109 deletions
File tree
- rewrite-core/src
- main/java/org/openrewrite/internal
- test/java/org/openrewrite/internal
- rewrite-maven/src
- main
- java/org/openrewrite/maven
- resources/META-INF/rewrite
- test/java/org/openrewrite/maven
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
91 | 99 | | |
92 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
93 | 112 | | |
94 | 113 | | |
95 | 114 | | |
| |||
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
91 | 137 | | |
92 | 138 | | |
93 | 139 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
0 commit comments