Maven Quick Reference Card
Maven Quick Reference Card
Starting Maven
mvn plugin:target [-Doption1 -Doption2 . . . ] mvn help mvn -X ... Prints debugging output, very useful to diagnose
Compiling
mvn compile
Cleaning Up
mvn clean
A$$ing &epen$encies
-dependencie". -dependency. -groupId.%unit-&groupId. -arti actId.%unit-&arti actId. -ver"ion.)./.1-&ver"ion. -"cope.te"t-&"cope. -&dependency. -dependency. -groupId.org."pring rame$or(-&groupId. -arti actId."pring-&arti actId. -ver"ion.1.2.0-&ver"ion. -&dependency. ... -&dependencie". /ecause of -"cope.te"t-&"cope., junit will not be included in %nal pac aging!
A$$ing &evelopers
-developer". -developer. -id.1aier-&id. -name.2an" 1aier-&name. -email.han".#aier::at:: ocu"-dv.de-&email. -organi3ation. ocu" D4 !m#2-&organi3ation. -role". -role.Developer-&role. -&role". -&developer. ... -&developer".
Creating Assem(lies
0o pac age the artifact use the following lines in the !pom-%le: -plugin. -arti actId.maven-a""em#ly-plugin-&arti actId. -con iguration. -de"criptor".
-de"criptor."rc&main&a""em#ly& oo-dep.'ml-&de"criptor. -de"criptor."rc&main&a""em#ly& oo.'ml-&de"criptor. -&de"criptor". -&con iguration. -&plugin. "rc&main&a""em#ly is the maven standard directory for assemblies! 0he %rst assembly descriptor pac ages all dependencies into one jar: -a""em#ly. -id.dep-&id. - ormat". - ormat.%ar-& ormat. -& ormat". -include1a"eDirectory. al"e-&include1a"eDirectory. -dependency6et". -dependency6et. -outputDirectory.-&outputDirectory. -unpac(.true-&unpac(. -"cope.runtime-&"cope. -e'clude". -e'clude.%unit:%unit-&e'clude. -&e'clude". -&dependency6et. -&dependency6et". -&a""em#ly. 0he second descriptor pac ages the program: -a""em#ly. -id.#in-&id. - ormat". - ormat.3ip-& ormat. -& ormat". - ile6et". - ile6et. -directory."rc&main&a""em#ly& ile"-&directory. -outputDirectory.-&outputDirectory. -include". -include.77&7.#at-&include. -include.77&native&77-&include. -include.77&7.propertie"-&include. -&include". -& ile6et. - ile6et. -directory.target-&directory. -outputDirectory.-&outputDirectory. -include". -include.7.%ar-&include. -&include". -& ile6et. -& ile6et". -&a""em#ly.
#upplementary %les in this example are in "rc&main&a""em#ly& ile". 0his includes the program starter *!bat+, native libraries *&native+ and Properties %les! Pac aging is invo ed by: mvn a""em#ly:a""em#ly
'ersioning
8eep the 9erision of your P:. artifact in the form version-#"3P#6:0 until you release! .avens release plugin then removes the -#"3P#6:0 sux!
Preparing Releases
.a e sure, the #C. settings in the P:. are correct and all changes are committed to the #C.! 0hen execute mvn -Du"ername=86@> -Dpa""$ord=AA66 relea"e:prepare /efore issuing the above command use it with -Ddry>un=true %rst "ote: 0his command will erase any -activation. tags in con%gured build pro%les in the pom.'ml
Copyright by 6ans /aier *hansbaier;web!de+, <ocus D9 =mb6, =ermany, 7icense: Public domain