0

I have a multimodule project, for which I wanted to do a verification on pre-requisites by running a shell script using exec-maven-plugin, when I run the below command

mvn exec:exec -Dexec.executable=/apps/rm-scripts/verify.sh

It goes through all the modules and execute the script, my requirement is, it should not look in to the modules, instead it should run only on the parent project

Can anyone plesae help?....thanks for your time

Krishna
  • 11
  • 3

1 Answers1

0

You can run maven with the --non-recursive option so the goal will only be run on the parent project:

mvn --non-recursive exec:exec -Dexec.executable=/apps/rm-scripts/verify.sh

If you need to run the script only on some projects, then use the --projects option. The given argument must be a list of path separated with commas.

With this project hierarchy:

project
 +-- module_A
 +-- module_B
 |    +-- module_B1
 |    +-- module_B2
 +-- module_C
      +-- module_C1

To run a command only for module_A, module_B1 and module_C2 projects:

mvn --projects module_A,module_B/module_B1,module_C/module_C2 exec:exec -Dexec.executable=/apps/rm-scripts/verify.sh
cbliard
  • 7,051
  • 5
  • 41
  • 47