Thursday, July 22, 2010

Maven build without installing dependent packages in local repository

If you split your large project into several maven projects, and put them in sibling folders as follows:

+- parent
+- api
+- persistence
+- core

and core depends on api and persistence, while persistence depends on api. You can run maven command in parent/ to build them all without installing the packages into local maven repository:

parent $ mvn clean package

If you just want to build persistence, and you go to the folder core, then run maven, you will be asked to install api into repository. You can overcome this by running this command in parent folder:

parent $ mvn -o -am -pl groupId:core clean package

because all packages are in sibling folders, you may want to try this command:

parent $ mvn -o -am -pl ../core clean package

But this won't work and you may get an error message like "Couldn't find specified project in module list: M:\..\parent\..\core". Check this: MNG-4262.

No comments:

Post a Comment