Home > Blockchain >  Exclude goal from being applied to submodules?
Exclude goal from being applied to submodules?

Time:11-04

I have the following project structure:

root 
  |___ submodule1
  |___ submodule2
  |___ submodule3 

and I have a custom plugin with a goal custom-plugin:custom-plugin that I sometimes want to run separately (not as a part of a phase).

When this goal is run as a part of the phase (that it is bound to) in the root, it doesn't get applied to submodules.

But when I call it separately as mvn custom-plugin:custom-plugin, it gets applied to the root AND submodules. I am, however, expecting it to get applied to the root project only.

Adding --non-recursive solves the problem, but is there any way to specify this directly in the pom.xml? To limit the plugin goal application scope to root only when running it separately.

CodePudding user response:

If you generally only want to run the plugin in the main POM, you can set

aggregator = true

in the @Mojo attribute in the plugin source code.

  • Related