maven beyond hello_world
DESCRIPTION
Maven presentation I held for Iasi - JUG ( iasi-jug.ro )TRANSCRIPT
![Page 1: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/1.jpg)
Maven beyond “Hello world”
by Gabriel Dogaru
![Page 2: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/2.jpg)
What / why / how?
● Corporate environment● Build large projects● 10+ modules
![Page 3: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/3.jpg)
Some hate maven
Maven builds are an infinite cycle of despair that will slowly drag you into the deepest, darkest pits of hell (where Maven itself was forged).
http://kent.spillner.org/blog/work/2009/11/14/java-build-tools.html
![Page 4: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/4.jpg)
“Sounds like my first wife.”
David Letterman
![Page 5: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/5.jpg)
What do I need ?
● Stable builds● Reproducible builds● Reports● Releases ● Control over source code and dependencies● Build automation● Easy development cycle● What else ???
![Page 6: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/6.jpg)
Do you know a ninja?
● Developers are smart ● Make builds fool proof● Have a build team
![Page 7: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/7.jpg)
Control your sources
Install an maven repository manager
http://maven.apache.org/repository-management.html
![Page 8: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/8.jpg)
Resolving dependencies
http://today.java.net/article/2010/01/04/maven-repository-managers-enterprise
![Page 9: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/9.jpg)
Deploying dependencies
http://today.java.net/article/2010/01/04/maven-repository-managers-enterprise
![Page 10: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/10.jpg)
~/.m2/settings.xml
![Page 11: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/11.jpg)
Control dependencies
● Use a parent pom (super pom)● maven-enforcer-plugin
![Page 12: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/12.jpg)
Parent pom example
http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html
![Page 13: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/13.jpg)
Use dependency management
![Page 14: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/14.jpg)
The Bigger, The Better
● Have many modules● Your IDE loves modules● Try to have separate modules if that makes
sense for you● Do you really need multi module projects?
http://monkeyisland.pl/2010/12/11/ide-and-patterns-for-huge-maven-project/
![Page 15: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/15.jpg)
All for One
one project => one artifact.
![Page 16: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/16.jpg)
Respect thy MAVEN
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
![Page 17: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/17.jpg)
Know your goals
![Page 18: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/18.jpg)
Know who you are
● Define your own archetypes● Define your own packaging
http://maven.apache.org/guides/mini/guide-creating-archetypes.html
![Page 19: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/19.jpg)
Groovy example
http://groovy.codehaus.org/Groovy-Eclipse+compiler+plugin+for+Maven
![Page 20: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/20.jpg)
Your build is unique
http://www.sonatype.com/books/mcookbook/reference/ch02s03.html
http://ronalleva.com/groovy/maven/programming/2008/01/23/using-the-groovy-maven-plugin-to-do-magic.html
![Page 21: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/21.jpg)
Leave your SNAPSHOT alone
![Page 22: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/22.jpg)
Now we release
![Page 23: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/23.jpg)
The release plugin
http://maven.apache.org/maven-release/maven-release-plugin/
![Page 24: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/24.jpg)
Gets along well with CI
![Page 25: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/25.jpg)
Make nice reports
http://maven.apache.org/plugins/maven-site-plugin/
http://mojo.codehaus.org/sonar-maven-plugin/
![Page 26: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/26.jpg)
Remember
● Maven is not that bad, could be pretty nice● Customize maven to fit your need● but respect the tool● You are never done● Have a master near by that knows the tool● Have a look at Gradle....
![Page 27: Maven beyond hello_world](https://reader034.vdocuments.net/reader034/viewer/2022052505/5552f4ddb4c90584028b4d3c/html5/thumbnails/27.jpg)
Thank You