Prevent ‘No plugin found’ in multi-module maven

Defining a maven plugin on a submodule in a multi-module maven project can give us a ‘No plugin found’ error. Especially if we have a multi-module project and we want to apply a maven plugin in only one specific module this error occur pretty often.

Let’s say we have a multi-module root pom which looks like this.

Instinctively we add the plugin (tomcat7 for example) to this specific module module2, like this.

When we run the command mvn tomcat7:help on the multi-module root pom we get the following error:

The solution is very simple: We specify the plugin in the pluginManagement section of our multi-module root pom.

And in our specific module module2 we clear the version of the plugin, since it is already defined in the multi-module root pom (the parent).

Now when can run the command mvn tomcat7:help and get no error. We are ready to configure the plugin on our submodule.