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

Passing extendedVariables Property using mvn -D Commandline Option #24

Closed
vhochstein opened this issue Dec 17, 2020 · 4 comments
Closed

Comments

@vhochstein
Copy link

Just a question..

./mvnw generate-resources -DextendedVariables=releaseTrain=20.11

Fails with following exception:
Unable to parse configuration of mojo se.bjurr.gitchangelog:git-changelog-maven-plugin:1.63:git-changelog for parameter extendedVariables: Cannot assign configuration entry 'extendedVariables' with value '${extendedVariables}' of type java.lang.String to property of type java.util.Map

Do you know correct syntax to pass extendedVariables Map using Commandline ?

@tomasbjerre
Copy link
Owner

No dont know.

@vhochstein
Copy link
Author

vhochstein commented Jan 4, 2021

@tomasbjerre I ve searched the web a little bit and asked corresponding question in Apache maven plugin group.

and I would like to share my findings with you:

@Parameter(property = "extendedVariables", required = false) private Map extendedVariables;

cannot be set by command line interface.. however, at least I found a post which came up with following solution (basically it means accepting map as a String[] and converting it to a map on your own:
@Parameter(property = "extendedVariables", required = false) private String[] mapEntries; private Map extendedVariables;

@Override public void execute() throws MojoExecutionException { map = Arrays.stream( mapEntries ).collect( Collectors.toMap( s -> s, s -> s ) );

What do you think about it. ( it would be great to have that feature for my purposes....=

Source:
https://stackoverflow.com/questions/31620967/any-way-to-specify-a-fileset-as-command-line-parameter/31630531#31630531

@tomasbjerre
Copy link
Owner

Released as 1.65

@tomasbjerre
Copy link
Owner

Usage:

17:36 $ mvn se.bjurr.gitchangelog:git-changelog-maven-plugin:1.65:git-changelog -DextendedVariablesCli="a=b,c=d"
...
[INFO] a = b
[INFO] c = d
...

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

No branches or pull requests

2 participants