Many of the plugins that would be used in a typical Maven
setup provide an option to skip execution of that plugin via the <skip>
configuration parameter or in the case of the Surefire plugin
, the -DskipTests
system property. Unfortunately some plugins, like the WebLogic Maven Plugin
do not offer this facility.
I had a situation where I wanted each of the developers to be able to locally do a build and automatically deploy to WebLogic
, but I didn't want jobs executed by the CI pipeline
to do any automatic deployments. Since the WebLogic
plugin didn't offer a skip
option, I had to find another way.
What I ended up doing was changing the <phase>
for the plugin to a variable instead of it being static. Something like this...
Then I could define the value for the skipPluginPhase
Leaving it as 'none'
would skip plugin execution, whereas putting in a valid phase like 'install'
would execute the plugin as expected. The only change each developer would need to do locally was update their version of the pom.xml
file to reflect this.
To avoid unnecessary editing of the pom.xml
file it is also possible to set up a number of different profiles
in your Maven
build. The default profile could then set skipPluginPhase
to a valid phase name and a profile set up just for the CI pipeline
could set skipPluginPhase
to none, whereby skipping plugin execution.
[Read More and Comment]