-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix filtering of web resources using system properties and escaping #451
Conversation
@@ -212,7 +217,6 @@ | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<artifactId>plexus-utils</artifactId> | |||
<!-- generated help mojo has a dependency on plexus utils --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the generated file did not contain any plexus-util imports
1893d78
to
d8aca59
Compare
replace plexus-util filtering with maven-filtering The code still in directly uses some plexus-util so the dependency is not removed but the comment was no longer correct so that was removed.
d8aca59
to
ddc51f3
Compare
or | ||
\@prop2\@ @prop2@ | ||
and these will be replaced at build time | ||
it is even possible to use system properties | ||
\@java.class.version\@ ${java.class.version} | ||
\@java.vendor.url\@ ${java.vendor.url} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class version is of the JVM not the compiled classes - so this would on java17 etc. replaced with vendor.rul which is very jvm specific - but it is 2023 so if this is not a https:// url then someone should fix the JVM...
MavenResourcesExecution mavenResourcesExecution = | ||
new MavenResourcesExecution(resources, webappDirectory, project, StandardCharsets.UTF_8.name(), filters, | ||
Collections.emptyList(), session); | ||
mavenResourcesExecution.setEscapeString("\\"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means we can escape things - which is what you would get with regular maven filtering.
technically this is a breaking change - but looking through projects of the 5 I found adding webResources
non used filtering anyway... so making this compatible would appear to be overkill
An argument could be made therefor to remove this code entirely - but as the webResources
are of type Resource
it would mean we would take options that would be discarded.
// assert globalConfigHelp.contains("\\@java.class.version\\@ 55.0"); | ||
assert globalConfigHelp.contains('${prop1} hello'); | ||
assert globalConfigHelp.contains('@prop2@ goodbye'); | ||
assert globalConfigHelp.contains('@java.vendor.url@ https://'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
showing a System property is now resolved.
assert globalConfigHelp.contains("\\@prop2\\@ goodbye"); | ||
// code claims to add System properties but this fails | ||
// assert globalConfigHelp.contains("\\@java.class.version\\@ 55.0"); | ||
assert globalConfigHelp.contains('${prop1} hello'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the escapes are now working - so they get replaced with the literal (in other words the escape string is correctly removed.
webResources
now consultsSystem.getProperties()
(again?)\${project.version}
and not have it replaced by the project version. (this matches Mavens' default behaviourReplaces code from plexus-util with maven-filtering.
The code still directly uses some plexus-util so the dependency is not removed but the comment was no longer correct so that was removed.