Parameter priority for a Maven Plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Parameter priority for a Maven Plugin

Oliver B. Fischer-2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Dear all,

I always believed that the commandline parameters for a Maven plugin
have a higher priority then the values configured in the configuration
element of a plugin configuration.

But now I have the problem, that we can't overwrite the plugin
configuration in the POM by commandline parameters. This behaviour is
reproducable and I have written tests for this.

Am I wrong or did I misunderstand something and the current behavior is
correct?

Oliver

BTW, we currently use org.apache.maven:maven-core:jar:3.5.0


- --
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
E [hidden email]
S oliver.b.fischer
J [hidden email]
X http://xing.to/obf
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEU7j685HGR9cAsMGwB88X6wLziPwFAl9ab/0ACgkQB88X6wLz
iPzpEw/9HnZRnvHHaT9Wkx9COlezKsucpoQIlqFb8b8LGO6OaS1Eo0BGGEO9qz+V
BeuPoBRUN0gPSufPehuM/X6yHPyczGIM/gUx8AahRqIVPysUBBVsTHIh9/RAH6fI
zS9ToTFissHfhzFshHafb39OD/EeZ/ftt8k20BfI5b7qkfIjytvYHsaFFY9ZVNhk
H3wKzbdvZ6EcG9hx3UjglLAQKWwyMDzVUDqp3P5Be/KDfSmmAPAqjwj0UKm8/E+6
p9QhrCgHOHKcKPOtXeScYS3RykkDNFoKUbPtsfmPQxNHtfjO6VkBvDNUsoDcf/He
3maEoJ7JxpUak0tU8Y87DJv8MLVsSkwhgIzmXpQR/MK8YJBkXpmNd2K4l1GVlro0
nFkjhVwgya39pt6B0m8EEIPQZhErGVrwqMPkWKaFShiDIz/meav1BVVWuiClYpBn
+uMCwOYM+0AnR609EvUNEBcd5HtO7Su2CSnKQkGRuOlPZ1A0QhCTCEcrV69QVb4P
M6/vIyVo2R6ZZXWYX00bYwVED92XpdO9peRdrW92TjTGdWHK2j5FqKntiIB99QuY
ekHTnVTVif8bMZplts3S1pY8Qeo/NdxbJ1Bu97VMCo5x7NUi+5qUCwhGlmgN9u3c
B0hoyiJa0+2CES980J1XrmlcK+JUeHWnfiEfutvZCpmbUxnnIkg=
=VP64
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Parameter priority for a Maven Plugin

Stuart McCulloch
If you configure a constant value in your POM then that takes precedence
over values from the command-line.

If you want to make the value configurable on the command-line and have a
default value in your POM then the recommended approach is to introduce a
property:

  <properties>
    <some-key>some-default-value</some-key>
  </properties>

          <plugin>
            <groupId>org.example</groupId>
            <artifactId>some-maven-plugin</artifactId>
            <configuration>
              <some-key>${some-key}</some-key>
            </configuration>
          </plugin>

https://issues.apache.org/jira/browse/MNG-4979

On Thu, 10 Sep 2020 at 19:27, Oliver B. Fischer <[hidden email]>
wrote:

>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> Dear all,
>
> I always believed that the commandline parameters for a Maven plugin
> have a higher priority then the values configured in the configuration
> element of a plugin configuration.
>
> But now I have the problem, that we can't overwrite the plugin
> configuration in the POM by commandline parameters. This behaviour is
> reproducable and I have written tests for this.
>
> Am I wrong or did I misunderstand something and the current behavior is
> correct?
>
> Oliver
>
> BTW, we currently use org.apache.maven:maven-core:jar:3.5.0
>
>
> - --
> N Oliver B. Fischer
> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
> P +49 30 44793251
> M +49 178 7903538
> E [hidden email]
> S oliver.b.fischer
> J [hidden email]
> X http://xing.to/obf
> -----BEGIN PGP SIGNATURE-----
>
> iQIzBAEBCAAdFiEEU7j685HGR9cAsMGwB88X6wLziPwFAl9ab/0ACgkQB88X6wLz
> iPzpEw/9HnZRnvHHaT9Wkx9COlezKsucpoQIlqFb8b8LGO6OaS1Eo0BGGEO9qz+V
> BeuPoBRUN0gPSufPehuM/X6yHPyczGIM/gUx8AahRqIVPysUBBVsTHIh9/RAH6fI
> zS9ToTFissHfhzFshHafb39OD/EeZ/ftt8k20BfI5b7qkfIjytvYHsaFFY9ZVNhk
> H3wKzbdvZ6EcG9hx3UjglLAQKWwyMDzVUDqp3P5Be/KDfSmmAPAqjwj0UKm8/E+6
> p9QhrCgHOHKcKPOtXeScYS3RykkDNFoKUbPtsfmPQxNHtfjO6VkBvDNUsoDcf/He
> 3maEoJ7JxpUak0tU8Y87DJv8MLVsSkwhgIzmXpQR/MK8YJBkXpmNd2K4l1GVlro0
> nFkjhVwgya39pt6B0m8EEIPQZhErGVrwqMPkWKaFShiDIz/meav1BVVWuiClYpBn
> +uMCwOYM+0AnR609EvUNEBcd5HtO7Su2CSnKQkGRuOlPZ1A0QhCTCEcrV69QVb4P
> M6/vIyVo2R6ZZXWYX00bYwVED92XpdO9peRdrW92TjTGdWHK2j5FqKntiIB99QuY
> ekHTnVTVif8bMZplts3S1pY8Qeo/NdxbJ1Bu97VMCo5x7NUi+5qUCwhGlmgN9u3c
> B0hoyiJa0+2CES980J1XrmlcK+JUeHWnfiEfutvZCpmbUxnnIkg=
> =VP64
> -----END PGP SIGNATURE-----
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Parameter priority for a Maven Plugin

Oliver B. Fischer-2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Thank you Stuart


Am 10.09.20 um 21:03 schrieb Stuart McCulloch:

> If you configure a constant value in your POM then that takes precedence
> over values from the command-line.
>
> If you want to make the value configurable on the command-line and have a
> default value in your POM then the recommended approach is to introduce a
> property:
>
>   <properties>
>     <some-key>some-default-value</some-key>
>   </properties>
>
>           <plugin>
>             <groupId>org.example</groupId>
>             <artifactId>some-maven-plugin</artifactId>
>             <configuration>
>               <some-key>${some-key}</some-key>
>             </configuration>
>           </plugin>
>
> https://issues.apache.org/jira/browse/MNG-4979
>
> On Thu, 10 Sep 2020 at 19:27, Oliver B. Fischer <[hidden email]>
> wrote:
>

>>


- --
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
E [hidden email]
S oliver.b.fischer
J [hidden email]
X http://xing.to/obf
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEU7j685HGR9cAsMGwB88X6wLziPwFAl9brUYACgkQB88X6wLz
iPzIAhAArlKTtfkk42P15E6nOEEnn9offq3w3cEod4txYX2zbhL+/fpNBWmu2bHE
ijqLpHY9bKibO0k7sIefyykivSL90yDlzIKNBMCUwfcE6aqsMszCY2Hos8sJufKD
3/JRiydwGK3+Kliy5CKBjhv4ZlhfmyJE1T5LDUVju+ZqqNbTrF9RbxE2n/Ye3WwI
aSoqlM29ocvPSrv8XpuWWjau6My/c4NpaQmSClAThcz6qq/TX8fCKtTY7fuHZhAT
jHUA02mAqax1COxkmQY7f364F/vN27kZyNHul7oMIGspF6WWBTKqLP+moSxgn/o0
ggAgzu5L9wKb6ay1fPT4YfHaz05I+iZ7OYw19Bc9WNK4McFHIBRqwcUdNBmdKb6U
WyDXLUGJMRxqOTDmzjpPN45RESKURALFpvnqMhXTro695WuTcTGPTP7KglhXZs9V
0tOOdc7d9H4IALkg+2Cs6sypyj5YYcbV6PJyI8/DgNfNJ0JtPUQcoYV3bYkuMESu
NAbz/GaADvCqcBqSm0MpMU5Mo+rCE9e05feJ2hvOb3pSHglYZbc8PlqLHyZRTCCD
1gpTjnBerp8kRw9tSq1/mt/o0XIvKQ+EGuDqERdN6YzeI1sEHFuThBgfu0OJDKOq
FK9vfjPyLRNbFTeNzbvIcb2HvyyjIlCsQW0AFXvcv2ddhQEsVNc=
=lVFd
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]