supertonsky
supertonsky

Reputation: 2743

How do I install maven plugin into an existing project?

Is there a proper way of doing this maybe through a command line? Or do I really have to modify the POM file itself? Let's say I want to install the maven war plugin into an existing project. I tried googling but I can only find the usage and not the installation to an existing project.

Upvotes: 0

Views: 271

Answers (2)

Raghuram
Raghuram

Reputation: 52665

As documented here,

Maven is - at its heart - a plugin execution framework; all work is done by plugins.

You must mean invoking or using a plugin than installing a plugin. You can invoke pretty much any maven plugin without updating the pom, so long as you are ok with the default configurations.

For instance, to generate a javadoc on a maven project, you could just type

mvn javadoc:javadoc

Now, coming to maven war plugin. This creates a war artifact of your project. It makes no sense to invoke it on a project, unless the project is a war project. If it is so, the packaging of the project should be war.

<packaging>war</packaging>

In this case, maven war plugin gets automatically invoked on it.

If you want to customize/configure a plugin or based on the type of plugin, you declare it in your pom (in <plugins> section and do the configurations).

Upvotes: 4

Dave Newton
Dave Newton

Reputation: 160321

You add the plugin to the POM.

Maven configuration is done via the POM; it's kind of the point--the POM defines the project.

Upvotes: 2

Related Questions