You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Enrico Olivelli <eo...@gmail.com> on 2019/11/30 17:42:20 UTC

Re: Overriding plugin parameters via commandline

Il ven 29 nov 2019, 23:15 Marco Herrn <hu...@googlemail.com.invalid> ha
scritto:

> Hi,
>
> if I try to call the following maven goal:
>
>   mvn kilt:reformat -Dformat="<key> = <value>\n"
>
> the parameter `format` is correctly set to the given value for the
> `reformat` goal of the `kilt-maven-plugin`.
>
> However, if I specify this parameter also in the pom.xml:
>
>       <plugin>
>         <groupId>de.poiu.kilt</groupId>
>         <artifactId>kilt-maven-plugin</artifactId>
>         <version>0.4.0-SNAPSHOT</version>
>         <configuration>
>           <format>&lt;key&gt;\t: &lt;value&gt;\n</format>
>         </configuration>
>       </plugin>
>
> the value given in the pom.xml always takes precedence. The cmdline
> parameter is ignored in that case.
>
> What do I have to do to be able to override the values in the
> configuration? Do I need to specify the parameter in the ReformatMojo of
> the kilt-maven-plugin differently? It is currently specified as:
>
>   @Parameter(property="format", defaultValue = "<key> = <value>\\n",
> required = true)
>   private String format;
>
> Do I need to specify something differently to override a configation
> setting in the pom.xml via commandline flags?
>
> In case you are curios, I am talking about that plugin:
> https://github.com/hupfdule/kilt/tree/master/kilt-maven-plugin






Hi,
This is expected, you have to declare your own property in the <properties>
section of your pom.xml with value equals to your 'default' value.
Then you configure the plugin to use your new properly
<format>${myformat}</format>

Cheers
Enrico

>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>