Introduction. In Maven, there are two kinds of plugins, build and reporting: Build plugins are executed during the build and configured in the <build/> element. Reporting plugins are executed during the site generation and configured in the <reporting/> element.
Almost any action that you can think of performing on a project is implemented as a Maven plugin. Plugins are the central feature of Maven that allow for the reuse of common build logic across multiple projects.
However, as previously mentioned, the user may have a need for third-party plugins. Since the Maven project is assumed to have control over the default plugin groupId, this means configuring Maven to search other groupId locations for plugin-prefix mappings. As it turns out, this is simple.
I find these plugins the most useful in my day-to-day work:
There is so much more explore and much depends on your project needs of course. And of course one of the most useful plugins that I use are the ones I wrote myself for some specific needs. This is one of the most valuable features of maven - the ability to easily extend it.
The Maven Versions Plugin, very useful to check and manage versions of POMs and dependencies:
versions:display-dependency-updates
- scans a project's dependencies and produces a report of those dependencies which have newer versions available.versions:display-plugin-updates
- scans a project's plugins and produces a report of those plugins which have newer versions available.versions:update-child-modules
- updates the parent section of the child modules of a project so the version matches the version of the current project. For example, if you have an aggregator pom that is also the parent for the projects that it aggregates and the children and parent versions get out of sync, this mojo can help fix the versions of the child modules. (Note you may need to invoke Maven with the -N option in order to run this goal if your project is broken so badly that it cannot build because of the version mis-match).versions:set
- can be used to set the project version from the command line.The maven jetty plugin is pretty awesome, it helps make web application development much easier. Rather than packaging your application, you can simply do this:
mvn jetty:run
And your application starts.
The Maven Dependency Plugin is another mandatory plugin to debug/clean/understand a POM and how you get some dependency (transitively):
dependency:analyze
- analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared.dependency:tree
- displays the dependency tree for this project.The Maven Enforcer Plugin which allows to control that all plugins have a specified version or certain environmental constraints such as Maven version, JDK version and OS family along with many more standard rules and user created rules.
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