Skip to content
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

Enhancement: Apply multiple regex replacements to a single property #77

Open
JonathanLennox opened this issue Aug 8, 2019 · 2 comments

Comments

@JonathanLennox
Copy link

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.)

@tehhowch
Copy link

This would be nice to have, i agree

@slawekjaranowski
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants