-
Notifications
You must be signed in to change notification settings - Fork 455
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
Allow replacement to be null for Replace and ReplaceRegex of plugin maven #1359
Comments
That's a great idea! Happy to merge a PR for this. I think these are the relevant places spotless/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/Replace.java Lines 38 to 40 in 7667a84
spotless/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/ReplaceRegex.java Lines 38 to 40 in 7667a84
As a workaround, you can try XML escape sequences like |
Thanks for the quick response. Will prepare a PR soon.
Sadly this does not work... Maven will still trim it and will get the same error when running spotless:apply...
|
Fixed in |
Thanks @nedtwigg ! |
In HBase, we want to purge useless javadoc tags and this is what currently we have done
https://github.com/apache/hbase/blob/23a56331dbeaa2016a27abbd1c094ce88bcf966a/pom.xml#L2737
Actually this is copied and modified from a gradle project
https://apache.googlesource.com/geode/+/refs/tags/rel/v1.11.0/gradle/spotless.gradle
You can see that we use '\n' instead a empty string because maven will consider the option is not provided if we use empty string and because of the check in this line
spotless/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/ReplaceRegex.java
Line 38 in 7667a84
The spotless:apply execution will fail.
But actually, the '\n' does not work, spotless:apply will ignore the '' and leave a 'n' there...
Before
After spotless:apply
I've opened an issue in HBase, for solving this problem
https://issues.apache.org/jira/browse/HBASE-27400
But till now I couldn't find a proper way...
So I wonder if we could change the implementation of ReplaceRegex, to not force replacement to be non-null. If it is null, we just use an empty string as the replacement.
WDYT?
Thanks.
The text was updated successfully, but these errors were encountered: