build-helper-maven-plugin
build-helper-maven-plugin copied to clipboard
Enhancement: Apply multiple regex replacements to a single property
I'd like to be able to define a property by applying multiple possible regex replacements to a value.
Specifically, I'd like to be able to, in Maven, canonicalize the Java "arch" parameter in the same way as JNA does in its Platform.getNativeLibraryResourcePrefix(), as follows:
${os.arch}: amd64|x86_64 -> x86-64 i[3-6]86 -> x86 powerpc -> ppc arm.* -> arm
(If there's already a way to do this with the existing regex-properties rule, it's not clear to me how to do it; consider this a doc enhancement request if so.)
This would be nice to have, i agree
As I understand you want to have a multiple regex
value in regex-property
goal.
It should be not more complicated to implements.
At first in: https://github.com/mojohaus/build-helper-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertyMojo.java
try to change:
@Parameter(required = true)
private String regex;
to
@Parameter(required = true)
private Set<String> regex;
and follow required changing in the rest code until project will build and all ITs pass.
simply test
mvn verify
and with ITs
mvn verify -P run-its