0

Is there a way to selectively specify which modules to install while building a complete reactor project?

In essence I would like to package the complete reactor content but only install a few.

Guy Segev
  • 41
  • 5
  • That sounds strange can you describe more in detail what you like to achieve and how your project look like and why you are trying to go that way? – khmarbaise Jun 09 '14 at 10:43

2 Answers2

0

There are many option that allow you to manage a modulare project in maven.

To Resume Build

The -rf or --resume-from option can come in handy if you want to tell the Maven Reactor to resume a build from a particular project.This can be useful if you are working with a large multimodule project and you want to restart a build at a particular project in the Reactor without running through all of the projects that precede it in the build order.

Example mvn --resume-from yourmodule install

Specifying a Subset of Projects

The -pl or --projects option allows you to select a list of projects from a multimodule project. This option can be useful if you are working on a specific set of projects, and you’d rather not wait for a full build of a multi-module project during a development cycle.

Example mvn --projects yourmodule1,yourmodule2 install

Making a Subset of Projects

If you wanted to run a portion of the larger build, you would use the -pl or --projects option with the -am or --also-make option. When you specify a project with the -am option, Maven will build all of the projects that the specified project depends upon (either directly or indirectly). Maven will examine the list of projects and walk down the dependency tree, finding all of the projects that it needs to build.

Example mvn --projects sample-services --also-make install

You can find more detail on Maven: The complete references

Skizzo
  • 2,975
  • 8
  • 44
  • 89
  • Thanks for the swift replies; Alas I am well aware of all documented reactor options and indeed use them in conjunction with profiles specifying modules subset but I was hoping for a more elegant way of achieving it. Thanks anyway. – Guy Segev Jun 10 '14 at 06:17
  • @GuySegev From that that you wrote I understand that you don't knew how to manage reactor with modular project. For more details try to explain us your real problem – Skizzo Jun 10 '14 at 07:08
0

No; a single invocation of Maven will use the same phases for all modules.

You could chain invocations; for example:

mvn package && mvn -pl web-app install

But then the dependencies of web-app would be taken from your local repository and not from the reactor used in the first invocation.

The safest option would be (as in Maven Modules + Building a Single Specific Module) to use -am and -pl to install only a specific module along with all its dependencies:

mvn -pl web-app -am install

Note that this will still install other modules, but only those necessary to build web-app.

Community
  • 1
  • 1
Joe
  • 23,380
  • 9
  • 61
  • 75