1

We have a plugin that needs to be run via cmd, for example:

mvn com.test.plugins:some-plugin:2.1.0:generate

There is a root pom.xml, which has 3 modules

<modules>
    <module>first</module>
    <module>second</module>
    <module>third</module>
</modules>

And when the plugin is launched in this way from the root directory, the plugin is launched 4 times, in each module. I know that if you were writing the plugin configuration in pom.xml

<build><plugins><plugin>

we can use the tag

<inherited>false</inherited>

How can I do this through the console? Or maybe we can add something to the Mojo class of the plugin?

oliaaa_s
  • 59
  • 5
  • you mean to run that plugin only in the root module? If you call it from command line the plugin has to do that correctly... – khmarbaise Aug 06 '21 at 12:37
  • Does this answer your question? [Running a maven plugin only in the parent](https://stackoverflow.com/questions/6041033/running-a-maven-plugin-only-in-the-parent) – GeertPt Aug 06 '21 at 13:03

1 Answers1

1

Use the -N (or --non-recursive) command line parameter:

mvn -N com.test.plugins:some-plugin:2.1.0:generate
GeertPt
  • 16,398
  • 2
  • 37
  • 61