Is it possible to do?
The environment: Multimodule pom consists of 3 modules: mm1, mm2, mm3. Module mm2 has mm1 as dependency. It is possible to build parent pom without any errors.
The question: Is it possible to build single module mm2 (i.e., run maven from mm2 base directory) without installing mm1 into local repository?
Thanks.
From your workspace navigate to File → New → Other and from the wizard selection screen select Maven → Maven Module. Type a name for the module in the Module Name field. Click the Browse button beside the Parent Project field. This will launch a project selection box.
Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.
Change or add '<packaging>pom</packaging>' . Add a sub-module ( Right click on Parent Module -> New -> other -> Maven -> Maven Module -> Next ( Select both checkboxes ) -> Next -> jar or war -> Finish ).
Add a Java Maven Dependency to the Utility ProjectRight-click the utility project, and select Maven>Add Dependency. Type a dependency name in the Enter groupID… field (e.g., commons-logging) to search for a dependency. Select the dependency, and click OK.
I'm not sure what you mean exactly by "without installing mm1 into local repository". Do you mean previously to building mm2 or never?
In doubt, maybe one of the new build options announced in the Maven Tips and Tricks: Advanced Reactor Options blog post can help:
Starting with the Maven 2.1 release, there are new Maven command line options which allow you to manipulate the way that Maven will build multimodule projects. These new options are:
-rf, --resume-from Resume reactor from specified project -pl, --projects Build specified reactor projects instead of all projects -am, --also-make If project list is specified, also build projects required by the list -amd, --also-make-dependents If project list is specified, also build projects that depend on projects on the list
I was specifically thinking to the -pl
and -am
options. To build a subset of the modules, run the following from the root directory
$ mvn --projects mm2 --also-make install
However, I'm not sure this answers your question (which is not totally clear for me).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With