2

I'm using Maven 3.2.3 on Mac 10.9.5 (Java 6) with bash shell. Per the accepted answer on this thread -- How do I exclude certain modules from a maven build using the commandline, I'm trying to run a Maven build on my multi-module project while excluding some modules from teh build, so I have crafted this command

davea$ mvn clean install -pl org.mainco.subco:subco,org.mainco.subco:database,org.mainco.subco:mainmodule,org.mainco.subco:moduleB,org.mainco.subco:moduleD,org.mainco.subco:moduleC,\!org.mainco.subco:moduleF  -DskipTests

However, something about the “!” syntax is failing because I get the error

[ERROR] Could not find the selected project in the reactor: org.mainco.subco:moduleF -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

The error is complaining about the very module I want to exclude. What is the proper command line syntax? (Note: I’m not interested in editing my parent pom.xml file, this question is strictly concerned with excluding modules via the command line).

Community
  • 1
  • 1
Dave
  • 15,639
  • 133
  • 442
  • 830
  • I am having similar problems. I can use -pl dir/subdir to just compile subdir, but I can't find a syntax that allows me to exclude the same directory. I tried -pl \!dir/subdir and several other variations and haven't found a way yet. – Sinc Mar 24 '16 at 21:08
  • Since you are explicitly listing the modules you do want do you really need to have the one specifically excluded? Isn't that unnecessary? Or are you maybe really trying to do -pl org.mainco.subco:subco,!org.mainco.subco:subco:moduleF? That is, to exclude a single sub module of another module that you included (and that implicitly includes all its sub-modules)? – Sinc Mar 24 '16 at 21:12

0 Answers0