Question

I have a Maven aggregate (parent) project with three child modules. One of these modules is an Android project that can be deployed to a device emulator. I'd like to be able to run 'mvn clean install android:deploy android:run' from my top-level parent project and have it run 'mvn clean install' on ALL child modules and 'mvn android:deploy android:run' on ONLY my Android module. I need to be able to run all of the maven commands from one line in order to integrate with a continuous integration suite.

Is there a way to do this (either with a special configuration in my POM files or by passing in specific command line arguments)?

I tried following the instructions here: Maven profile for single module. I setup two profiles (one containing all modules, and one containing only my Android module) and running something like 'mvn -Pall clean install -Pandroid android:deploy android:run' but Maven wasn't capable of parsing different profile arguments for different targets.

Thanks very much.

Was it helpful?

Solution

Is there a way to do this (either with a special configuration in my POM files or by passing in specific command line arguments)?

Sort of, suppose you are using maven profile here, you can put two mvn commands in one line, and second command will start after first one finish.

In Linux, use:

mvn -Pall clean install ; mvn -Pandroid android:deploy android:run

In Windows, use:

mvn -Pall clean install & mvn -Pandroid android:deploy android:run

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top