While configuring my pom.xml
, I had to configure a plugin. What I found out is that the <plugin>
tag may be inserted inside either <plugins>
or <pluginManagement>
elements. I am confused!
What is the difference between <plugins>
and <pluginManagement>
?
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.
Both plugins and dependencies are Jar files. But the difference between them is, most of the work in maven is done using plugins; whereas dependency is just a Jar file which will be added to the classpath while executing the tasks. For example, you use a compiler-plugin to compile the java files.
Plugins are specified in pom. xml using plugins element. Each plugin can have multiple goals. You can define phase from where plugin should starts its processing using its phase element. We've used clean phase.
Plugins are the central feature of Maven that allow for the reuse of common build logic across multiple projects. They do this by executing an "action" (i.e. creating a WAR file or compiling unit tests) in the context of a project's description - the Project Object Model (POM).
From Maven documentation:
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one. However, this only configures plugins that are actually referenced within the plugins element in the children. The children have every right to override pluginManagement definitions.
You can look at a better answer
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