NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ
for more details.
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.
Hope you found this post useful...
...so please read on! I love writing articles that provide beneficial information,
tips and examples to my readers. All information on my blog is provided free of
charge and I encourage you to share it as you wish. There is a small favour I ask in return however -
engage in comments below, provide feedback, and if you see mistakes let me know.
If you want to show additional support and help me pay for web hosting and
domain name registration,
donations, no matter how small, are always welcome!
Use of any information contained in this blog post/article is subject to this disclaimer
Other posts you may like...