If I have multiple executions of a Maven plugin and they share at least one of the same configuration values, is there a way for me to share this configuration between all executions of the plugin.
Consider the trivial case of a build plugin with two executions:
<plugin>
<!-- ID, version... -->
<executions>
<execution>
<id>ID1</id>
<configuration>
<myConfig>foo</myConfig>
...
</configuration>
</execution>
<execution>
<id>ID2</id>
<configuration>
<myConfig>foo</myConfig>
...
</configuration>
</execution>
</executions>
</plugin>
How can I rewrite this so that both the ID1
and the ID2
executions use the same value for the myConfig
configuration?
Why not move common configuration outside concrete executions?
<plugin>
<!-- ID, version... -->
<configuration>
<commonConfig>foo</commonConfig>
</configuration>
<executions>
<execution>
<id>ID1</id>
<configuration>
<specificConfig>bar</specificConfig>
</configuration>
</execution>
<execution>
<id>ID1</id>
<configuration>
<specificConfig>baz</specificConfig>
</configuration>
</execution>
</executions>
</plugin>
It works for some plugins I use (e.g. gmaven-plugin) and in Maven documentation I haven't found any evidence it shouldn't work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With