In this post, We will talk and learn about Understanding the purpose of Maven Plugin
What is Maven Plugins?
- Maven Plugin is one of the important features that is basically used to reuse the common build logic among different projects.
- Plugins are used in many ways like compiling code, testing them with the Junits, creating jar/war/ear files and documentation of the projects.
- Maven is nothing but a plugin execution framework in which every task is accomplished by the usage of plugins.
Below is the basic list of tasks that are handled by plugins in maven :
- Creating jar/war/ear files.
- Code compilation
- Unit testing of the code.
- Project documentation
Types of Maven Plugins
There are mainly two important types of plugins exist in maven:
- Build Plugins – These plugins will execute during the build phase. These plugins are defined under the <build> element in pom.xml
- Report Plugins – These types of plugins are executed during the site generation (report or javadocs generation) phase. These plugins We can configure under the <reporting> element in pom.xml
Plugin name | Description |
clean | Used to delete the target directory in order to clean up the earlier build artifacts |
compiler | To compile java source files |
surefile | Executes the Junit tests and generate the reports. |
jar | Build the jar file of the project |
war | Build the war file of the project |
javadoc | Generates the javadocs of the project |
antrun | To run a set of ant tasks specified in any stage/phase of the build |
That’s all about Understanding the purpose of Maven Plugin
If you have any feedback or suggestion please feel free to drop in below comment box.