Maven itself cannot do this (yet). Currently, the build process performs all the tasks for each module separately. Plans allow targets to see the big picture, but perhaps for Maven 4.
At the same time, you can use a small shell script:
mvn clean install && mvn deploy -DskipTests=true
The first launch creates everything. The second run will not do much (all code has already been compiled and long tests have been skipped), so it is pretty fast.
I really prefer this approach because my script also replaces any existing distributionManagement elements with those for my company cache. This means that I can deploy any project for my company without making any changes to the original POM. Here is the script:
#!/bin/bash if [[ ! -e pom.xml ]]; then echo "Missing pom.xml" 1>&2 exit 1 fi sed \ -e '/<distributionManagement>/,/<\/distributionManagement>/d' \ -e '/<\/project/d' \ pom.xml > pom-deploy.xml || exit 1 cat >> pom-deploy.xml <<EOF <!-- ADDED BY $0 --> <distributionManagement> ... whatever you need ... </distributionManagement> </project> EOF mvn -f pom-deploy.xml clean install && \ mvn -f pom-deploy.xml deploy -DskipTests=true && \ rm pom-deploy.xml exit 0
gist
source share