plug-ins in Maven

In maven, plugins play an important role in maven build process. Each phase is executed by plug-in. Each plugin can be configured as per it’s specification. For example – we can configure the surefire plugin to run tests from specific category only. Maven plug-ins can be divided into 2 types.
  • build – Build plugins should be included in <build> tag. Build plugins are executed during build process.
  • reporting – Reporting plugins should be included in <reporting> tag. Reporting plugins are executed during site generation once the build process is complete. For example – javadoc and surefire-report are reporting plugins.
Plug-ins can also be categorized in below way.
  • Core (Most frequently used ones) – clean, compiler, surefire, deploy, install, resources, site
  • Packaging (Used for packaging the project artifacts)– jar, war, ear
  • Reporting – javadoc
  • Tools (used for performing tasks other than build process) – ant, archetype, help, release
Here is the list of some of the most popular plug-ins and their associated goals in maven.
  • compiler:compile – compiles project
  • archetype:generate – creates new project
  • surefire:test
  • clean:clean
  • deploy
  • install
  • resources
  • site
  • verifier
  • jar
  • war
  • javadoc
  • surefire-report
Complex problems, Simple Solutions