Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between <plugins> and <pluginManagement> tag in Maven `pom.xml` [duplicate]

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>?

like image 265
CALTyang Avatar asked Nov 04 '14 13:11

CALTyang


People also ask

What is the difference between plugin and pluginManagement tags?

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.

What is the difference in Maven between dependency and plugin tags in POM xml?

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.

What is plugin tag in POM xml?

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.

What is plugin tag in Maven?

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).


1 Answers

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

like image 60
Sergii Getman Avatar answered Oct 22 '22 04:10

Sergii Getman