tomasbjerre / git-changelog-maven-plugin

Maven plugin that can generate a changelog, or releasenotes, from git repository
Other
78 stars 35 forks source link

Passing extendedVariables Property using mvn -D Commandline Option #24

Closed vhochstein closed 3 years ago

vhochstein commented 3 years ago

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 commented 3 years ago

No dont know.

vhochstein commented 3 years ago

@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 commented 3 years ago

Released as 1.65

tomasbjerre commented 3 years ago

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