Frequently used Maven commands
# Command to Clean any previously build code
mvn clean
# Command to install
mvn install
# If you are behind a proxy then add this in the $USER_HOME/.me/settings.xml
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>myproxyhost.com</host>
<port>1234</port>
</proxy>
</proxies>
</settings>
# And for HTTPS traffic use this in the command line
mvn install -Dhttps.proxyHost="myproxyhost.com" -Dhttps.proxyPort="1234"
# For offline building (i.e. if you think you have all the required dependencies)
mvn –o install
# Command to install without executing unit tests
mvn install -Dmaven.test.skip=true
# Command to install but using a specific profile
mvn clean install -Ptomcat
# Command to use the Cargo Deploy plugin
mvn cargo:deploy
# Command to perform the release of a module
mvn -Dresume=false release:prepare release:perform
# Command to continue a release that stopped in the middile
mvn -Dresume=true release:prepare release:perform
# Command to do a Dryrun release
mvn release:prepare -DdryRun=true
# If SCM interactions are involved then below option can be used to provide a SCM Comment prefix
mvn -Dresume=false release:prepare release:perform -DscmCommentPrefix="Mvn Release 1.0:"
# Not all jar files are available in the Maven repository.
# Command to Upload a missing artifact jar into a local repository
mvn deploy:deploy-file -DgroupId=net.sf -DartifactId=jcsc -Dversion=0.98.1 -Dpackaging=jar -Dfile=JCSC.jar -DrepositoryId=thirdparty-jars -Durl=http://mavenrepo.comp.com/nexus/content/repositories/thirdparty-jars
# Command to create a maven project from an Artifact
mvn archetype:create -DgroupId=com.mycompany.myapp -DartifactId=basic-webapp -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DremoteRepositories=http://repo1.maven.org/maven2
# Command to check the version of maven plugin being used
mvn -Dplugin=install help:describe -Ddetail
# Command to Generate dependency tree
mvn dependency:tree -Doutput=dep-tree.txt
# List all dependencies of this project
mvn dependency:list
# Command to generate Site documentation
mvn site:site
# Commands to generate specific reports
mvn site:site -DgenerateReports=false -Dmaven.test.skip=true
mvn project-info-reports:summary -Dmaven.test.skip=true
mvn project-info-reports:scm project-info-reports:issue-tracking project-info-reports:index -Dmaven.test.skip=true
# Commands for various other reports
mvn taglist:taglist
mvn javancss:report
mvn dashboard:dashboard
mvn jdepend:generate
mvn changes:changes-report
mvn changes:jira-report
1 comment:
Thank You!
Post a Comment