~/.m2/settings.xml.
Maven Central official aliases (in past - mirrors):
Spring repos is server by Artifactory and available on:
Sonatype Releases Repository:
NetBeans:
JBoss Enterprise Maven Repository:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false mvn archetype:generate -DinteractiveMode=false \ -DgroupId=com.mycompany.app -DartifactId=my-app \ -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeGroupId=org.apache.maven.archetypes
Run build with -X option for verbose logging.
$ mvn help:describe -DartifactId=maven-war-plugin -DgroupId=org.apache.maven.plugins $ mvn help:describe -Dcmd=dependency:resolve -Ddetail $ mvn -X ...
What actual code processed by Maven (dump Maven config):
$ mvn help:effective-settings $ mvn help:effective-pom
List dependencies:
$ mvn dependency:tree $ mvn dependency:list
Resolve dependencies:
$ mvn dependency:resolve $ mvn dependency:resolve-plugins
Just download dependencies:
$ mvn dependency:get
or download a specific dependency (to the local M2 cache):
$ mvn dependency:get -Dartifact=$groupId:$artifactId:$version $ mvn dependency:get -DgroupId=$groupId -DartifactId=artifactId -Dversion=$version $ mvn dependency:get -DgroupId=$groupId -DartifactId=artifactId -Dversion=$version -DremoteRepositories=$repoUrl
Reason for inclusion or omitting dependencies:
$ mvn dependency:tree -Dverbose=true
Update pom.xml with latest dependency version:
$ mvn versions:use-latest-releases -Dincludes=$groupId:$artifactId
Print build classpath:
$ mvn dependency:build-classpath
Copy specific dependency to local directory:
mvn dependency:copy -Dartifact=... mvn dependency:copy -Dartifact=... -DoutputDirectory=.
Download POM, sources or javadoc:
mvn dependency:copy -Dartifact=$grp:$art:$ver:pom mvn dependency:copy -Dartifact=$grp:$art:$ver:jar mvn dependency:copy -Dartifact=$grp:$art:$ver:jar:sources mvn dependency:copy -Dartifact=$grp:$art:$ver:jar:javadoc
Copy all dependencies to local folder (default is target/dependencies):
mvn dependency:copy-dependencies mvn dependency:copy-dependencies -Dclassifier=sources mvn dependency:copy-dependencies -DoutputDirectory=libs
mvn dependency:resolve -Dclassifier=javadoc mvn dependency:resolve -Dclassifier=sources
mvn source:jar mvn javadoc:jar
To install sources or javadoc locally:
mvn source:jar install mvn javadoc:jar install mvn source:jar javadoc:jar install
To do that automatically on jar lifecycle:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
You can try redownload snapshots by:
$ mvn -U compile
You can fix damaged local ~/.m2 with:
$ mvn dependency:purge-local-repository
In order to perform really clean download:
$ mvn -Dmaven.repo.local=$HOME/.my/other/repository clean install
Check commands from versions-maven-plugin:
$ mvn versions:display-dependency-updates $ mvn versions:display-plugin-updates
Update pom.xml with latest dependency version:
$ mvn versions:use-latest-releases -Dincludes=$groupId:$artifactId
Update all versions in pom.xml to latest:
$ mvn versions:use-latest-releases $ rm pom.xml.versionsBackup
or:
$ mvn versions:use-latest-releases -DgenerateBackupPoms=false
Remove all SNAPSHOT versions:
$ mvn versions:use-releases -DgenerateBackupPoms=false
More details about versions plugin:
$ mvn help:describe -Dplugin=versions $ mvn help:describe -Dplugin=versions -Ddetail
mvn exec:java -Dexec.mainClass="com.vineetmanohar.module.Main" -Dexec.args="arg0 arg1 arg2"
test property substituded to **/${test}.java pattern and override any include/exclude patterns:
$ mvn test -Dtest=SeriousComponentTest
or mostly same:
$ mvn test-compile surefire:test -Dtest=RunMe
$ mvn -DskipTests package $ mvn -Dmaven.test.skip=true package
$ mvn -N deploy
$ mvn install:install-file -Dfile=... -DgroupId=... -DartifactId=... -Dversion=...
Additional option provides packaging type (JAR/WAR), source and javadoc files:
-Dpackaging=... -Dsource=... -Djavadoc=...