Index

Maven Command line

maven hello world
mvn archetype:generate -DgroupId=[group] -DartifactId=[app] -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
cd [app]
mvn package
java -jar target/*.jar
generate an archetype from non standard archetype group
mvn archetype:generate -DgroupId=test -DartifactId=test -Dpackage=test \
 -Dname="parent top level" -Dversion="1.0" \
 -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=pom-root \
 -DinteractiveMode=false
provided archetypes
https://maven.apache.org/guides/introduction/introduction-to-archetypes.html
list all archetypes
mvn archetype:generate
create eclipse project
mvn eclipse:eclipse
create eclipse project and download sources for dependencies
mvn eclipse:eclipse -DdownloadSources=true
compile
mvn compile
force dependency resolution
mvn clean package -U
run
mvn compile exec:java -Dexec.mainClass=com.example.Example
create artifact
mvn clean package
create artifact and run integration tests
mvn clean verify
install artifact into local maven repository
mvn clean install
install artifact & source jar into local maven repository
clean install source:jar
run checkstyle
mvn checkstyle:checkstyle
create documentation site
mvn site
skip tests
mvn verify -Dmaven.test.skip=true
run tests, but ignore failures
mvn verify -Dmaven.test.failure.ignore=true
run a single cucumber test
mvn clean verify -Dcucumber.options="--tags @AC-115"

Help

show the effective pom
mvn help:effective-pom
show the effective settings
mvn help:effective-settings
list active profiles
mvn help:active-profiles
describe a plugin
mvn help:describe -Dplugin=help
describe a plugin verbose
mvn help:describe -Dplugin=help -Dfull
describe a single goal of a plugin
mvn help:describe -Dplugin=help -Dmojo=help
show dependencies
mvn dependency:resolve
mvn dependency:resolve | sort | grep "    "
mvn dependency:tree
show dependency resolution for a specific dependency
mvn dependency:tree -Dverbose -Dincludes=commons-collections

Releasing

Sets the current project's version and propagate onto child modules
mvn versions:set -DnewVersion=6.2.0 -DgenerateBackupPoms=false
mvn versions:set -DgroupId=org.apache.maven.* -DartifactId=* -DoldVersion=2.* -DnewVersion=2.1.0-SNAPSHOT
show versioned properties => generate HTML report of all dependencies
versions:property-updates-report
firefox target/site/property-updates-report.html

Maven POM

set java version for javac
<properties>
   <maven.compiler.source>1.8</maven.compiler.source>
   <maven.compiler.target>1.8</maven.compiler.target>
 </properties>
Maven local dependency
<dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/sqljdbc4.jar</systemPath>
        </dependency></column>
exclude all transitive dependencies (maven3)
<exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
Maven OSGI ignore packages
<osgiManifest>
<bundleActivator>com.gxwebmanager.solutions.wmsconnectorapi.Activator</bundleActivator>
<bundleSymbolicName>com.gxwebmanager.solutions.wmsconnectorapi</bundleSymbolicName>
    <bundleSource>svn+ssh://subversion/vol/subversion…. </bundleSource>
    <ignorePackage>
        com.sun.jimi.core,
        com.sun.net.ssl
    </ignorePackage>
    <exportPackage>
        com.gxwebmanager.solutions.wmsconnectorapi.api,
        com.gxwebmanager.solutions.wmsconnectorapi.api.impl,
        com.gxwebmanager.solutions.wmsconnectorapi.api.util
    </exportPackage>
</osgiManifest>

spring repo

repo URL
https://repo.spring.io/libs-release
It can be browsed and searched directly via the web at
http://repo.springsource.org
FAQ
https://github.com/rstoyanchev/spring-framework/wiki/SpringSource-repository-FAQ#wiki-what_is_repo