Posted in Information Technology, Software Engineering

Maven Cheat Sheet

Commands

General command structure

mvn -P<profile> <command> <scope>

Simple stuff

mvn help
mvn compile
mvn validate
mvn verify
mvn test
mvn clean 
mvn clean package
mvn clean install
mvn clean deploy

Artifacts

mvn archetype:create                    # Create pom.xml

mvn archetype:create -DgroupId=<group> \     # Create JAR
                     -DartifactId=<new id>

mvn archetype:create -DgroupId=<group> \     # Create WAR
                     -DartifactId=<new id> \
                     -DarchetypeArtifactId=maven-archetype-webapp

mvn install:install-file <params>            # Install dependencies

Releasing

mvn deploy:deploy-file <params ...>

# Useful release options:
#
#    -P <profile>
#    -Dusername=<user>
#    -Dpassword=<password>
#
mvn release:prepare
mvn release:clean
mvn release:perform

Tomcat Plugin

mvn tomcat:deploy
mvn tomcat:redeploy
mvn tomcat:undeploy
mvn tomcat:stop
mvn tomcat:start

IDE integration

mvn -Declipse.workspace=<path> eclipse:add-maven-repo
mvn eclipse:eclipse

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s