toursjug-maven 3.x, will it lives up to its promises
DESCRIPTION
Maven 3.x @ Tours Java Users Group - May 18th, 2011TRANSCRIPT
![Page 1: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/1.jpg)
APACHE MAVEN 3.X Will it live up to its promises?
![Page 2: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/2.jpg)
2
Arnaud Héritier • eXo - Software Factory Manager
» In charge of tools and methods
• Apache Maven : » Committer since 2004 and member of the
Project Management Committee
• Coauthor of « Apache Maven » » published by Pearson (in French)
• Contact me : » http://aheritier.net » Twitter : @aheritier » Skype : aheritier
![Page 3: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/3.jpg)
3
Definition
• Apache Maven is a software project management and comprehension tool.
• Based on the concept of a project object model (POM) » Maven can manage a project's build, binaries,
reporting and documentation from a central piece of information.
• Apache Maven is standards/conventions driven » How many of you are doing JEE and related
developments ?
![Page 4: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/4.jpg)
4
History
• Initiated in 2001 by Jason Van Zyl in Alexandria, an Apache Jakarta project,
• Moved to Turbine few months after, • Became a Top Level Project in 2003. • Maven 2.0 released in September 2005 • Maven 3.0 released in October 2010
» 3.0.3 – March 2011
![Page 5: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/5.jpg)
5
Choose your way of thinking
Conventions approach Scripting approach
![Page 6: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/6.jpg)
6
Competitors
• Ant + Ivy, Easy Ant, Gant, Gradle, Buildr… • Script oriented
» You can do what you want ! • Reuse many of Maven conventions (directories layout,
…) and services (repositories) but without enforcing them
• The risk for them : Not being able to evolve due to the too high level of customization proposed to the user. » We tried on Maven 1 and it died because of that. It was
impossible to create a set of tests to cover all usages. » It’s like providing a framework without a well tested set of
public API
![Page 7: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/7.jpg)
7
With scripts oriented builds
You can have (if you have good skills)
But often you have (moreover after years …)
![Page 8: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/8.jpg)
8
With Maven
We dream to deliver (Maven 3.x)
But yesterday we too often had (Maven 2.x)
![Page 9: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/9.jpg)
9
BACKWARD COMPATIBILITY Apache Maven 3.x
![Page 10: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/10.jpg)
10
Backward compatibility - Criticisms
• Migration from Maven 1 to Maven 2 was impossible. Everything had to be re-done.
• Updates between 2.x versions and also between 2.0.x weren’t often without side effects.
![Page 11: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/11.jpg)
11
Backward compatibility
• Near to 700 integration tests • Tested for several months on a large set of
OSS projects • 7 alphas + 3 betas versions • A bug fix release every 6 weeks • It’s a revolution under the hood but an
evolution for end users
![Page 12: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/12.jpg)
12
Maven 3.0.x ITs
674
![Page 13: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/13.jpg)
13
PERFORMANCES Apache Maven 3.x
![Page 14: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/14.jpg)
14
Performances - Criticisms
• Maven is slow • It spends its time to download the world • Whereas everybody has multicore CPUs, it
doesn’t allow to process modules builds in parallel
![Page 15: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/15.jpg)
15
Performances
• A set of benchmark tools was developed to measure Maven performances (IO, CPU, Memory, Network …)
• Startup and execution times are reduced » Java 5 optimizations » Code cleanup and improvements
• Reduced Memory footprint • Artifacts Resolution Caching
» .lastUpdated files in your local repo » Enforce checks with –U option
![Page 16: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/16.jpg)
16
Performances – Parallel builds
• Parallel builds » An execution plan is predefined at startup to
define which modules could be built in // » Requires to have up to date plugins to avoid dead
locks and some others issues » Launch a build with 2 threads
• mvn –T 2 install
» Launch a build with 2 threads per CPU core • mvn –T 2C install
![Page 17: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/17.jpg)
17
Performances – mvnsh
• Performances optimizations » Intelligent cache system (artifacts resolution,
project descriptors …) » No need to restart a JVM for each build
• Cross platform « unix like » shell » Alias, environment settings … » Color highlighting
![Page 18: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/18.jpg)
18
Performances – mvnsh
• All in one » Includes Maven 3.x » Allows to have color highlighting with “standard”
Maven 3.x • Developed and freely distributed by Sonatype
![Page 19: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/19.jpg)
19
Performances – mvnsh
![Page 20: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/20.jpg)
20
EXTENSIBILITY Apache Maven 3.x
![Page 21: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/21.jpg)
21
Extensibility - Criticisms
• It is difficult and time consuming to extend maven (write plugins) » Many unknown technologies like Plexus for IOC
• It is difficult/impossible to reuse maven plugins » Its impossible to extend plugins/mojo and
lifecycles
![Page 22: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/22.jpg)
22
Extensibility
• New APIs to improve abstraction of underneath implementation » Aether : to manage artifacts and repositories
• Plugin classloader partitioning • Embeddable • IOC replaced by Guice
» For now (3.0) a wrapper is hiding the change » You don’t yet use Guice directly (from plugins for
example)
![Page 23: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/23.jpg)
23
ROBUSTNESS Apache Maven 3.x
![Page 24: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/24.jpg)
24
Robustness - Criticisms
• Builds aren’t predictable • Errors are difficult to diagnose
![Page 25: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/25.jpg)
25
Robustness - Validations
• Many more validations in POMs (warnings or errors) » Missing plugins versions » Duplicated dependencies in a POM » Incoherent inheritance (wrong relative path or
parent not in the upper directory) • Improved error messages with links to wiki
pages for more detailed information
![Page 26: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/26.jpg)
26
Robustness – Artifacts management
• Parent POMs prefer to resolve from repositories » Version less parent will be available in a future
maven 3.x release by using the relativePath element
• Profiles usage consolidation » No more profiles.xml (incompatible with future
polyglot feature)
![Page 27: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/27.jpg)
27
Robustness – Artifacts management
• No more support for legacy repository layout for Maven 1.0
• SNAPSHOTs are always deployed with timestamps
![Page 28: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/28.jpg)
28
Robustness – Plugins management
• Plugin version is by default RELEASE and no more SNAPSHOT » Affects command-line invocation
• Plugins cannot use versions LATEST or RELEASE » Affects command-line invocation and POM
• Plugins are resolved only from <pluginRepository> entries
![Page 29: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/29.jpg)
29
Robustness – Site plugin
• Site plugin is now completely extracted from Maven core » It has its own lifecycle » reporting section in POM becomes useless
(moved in plugin configuration)
![Page 30: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/30.jpg)
30
POM Apache Maven 3.x
![Page 31: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/31.jpg)
31
Criticisms
• XML, we don’t like it • POM is too verbose • POM v4 didn’t evolve last 5 years
» When will you add new common attributes to ease plugins configuration (encoding …)
» New feature like global exclusions
![Page 32: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/32.jpg)
32
POM
• No change in POM syntax for Maven 3.0 • Changes will occur in 3.x versions
» New model with a new version » Only new things » Generation / deployment of 4.0.0 current POM to
keep backward compatibility with old maven versions
• Mixins to allow to import POM fragments
![Page 33: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/33.jpg)
33
POM - Polyglot
• Developed and freely distributed by Sonatype • Extended version of Maven 3.0 using its new
embedding and extensibility capabilities • Allow translation (read/write) from/to various
syntaxes » Yaml » Scala » Groovy
• Allow macros and freeform scripting
![Page 34: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/34.jpg)
TO GO FURTHER … Apache Maven
![Page 35: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/35.jpg)
35
IDE Apache Maven
![Page 36: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/36.jpg)
36
Eclipse
• Integration from maven (eclipse:eclipse) » Allow many customizations » Support many versions/variants of eclipse » Support many usages (ear …) » Doesn’t support projects with “pom” packaging » Few support from dev team » Many bugs in classpath management » Asynchronous
• You have to regenerate and reload project each time you change a POM)
![Page 37: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/37.jpg)
37
Eclipse
• Integration from eclipse (m2eclipse) » Synchronous » Nice UI and services to edit POMs » Support projects with “pom” packaging » Doesn’t support all usages like EAR with WTP » Doesn’t support very well a large number of
modules » Slow down eclipse on large projects because of a
lack of support of incremental build in Maven 2.x and its plugins
![Page 38: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/38.jpg)
38
Eclipse (m2eclipse)
![Page 39: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/39.jpg)
39
Eclipse (m2eclipse)
![Page 40: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/40.jpg)
40
Eclipse (m2eclipse)
![Page 41: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/41.jpg)
41
Idea IntelliJ
![Page 42: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/42.jpg)
42
Netbeans
![Page 43: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/43.jpg)
43
COMMUNITY Apache Maven
![Page 44: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/44.jpg)
44
Users Mailing List
• Blue : » Number of subscribers
• Red : » Number of messages
per day
• [email protected] » Traffic statistics cover a
total of 2025 days. » Current subscribers: 1936 » Current digest
subscribers: 48 » Total posts (2025 days):
89687 » Mean posts per day:
44.29 • http://pulse.apache.org/
![Page 45: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/45.jpg)
45
Apache Maven Web Site
![Page 46: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/46.jpg)
46
Dowloads
Per month downloads http://people.apache.org/~vgritsenko/stats/
projects/maven.html
![Page 47: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/47.jpg)
47
The team
• 60 committers, • More than 30 active in 2009, • Several organizations like Sonatype, deliver
resources and professional support, • A community less isolated : more interactions
with Eclipse, Jetty,
![Page 48: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/48.jpg)
48
Commit Statistics
• In light blue the number of active commiters
![Page 49: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/49.jpg)
49
DOCUMENTATIONS Apache Maven
![Page 50: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/50.jpg)
50
Some links
• The main web site : » http://maven.apache.org
• Project’s team wiki : » http://docs.codehaus.org/display/MAVEN
• Project’s users wiki : » http://docs.codehaus.org/display/MAVENUSER
![Page 51: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/51.jpg)
51
Books
• Nicolas De loof Arnaud Héritier » Published by Pearson » Collection Référence » Based on our own
experiences with Maven.
» From beginners to experts.
» In French only
![Page 52: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/52.jpg)
52
Books
• Sonatype / O’Reilly : » The Definitive Guide » http://
www.sonatype.com/books
» Free download » Available in several
languages
![Page 53: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/53.jpg)
53
Books
• Apache Maven 2 Effective Implementation » Brett Porter, Maria
Odea Ching » https://
www.packtpub.com/apache-maven-2-effective-implementation/book
![Page 54: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/54.jpg)
54
Books
• Exist Global » Better builds with
Maven » http://
www.maestrodev.com/better-build-maven
» Free download
![Page 55: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/55.jpg)
55
SUPPORT Apache Maven
![Page 56: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/56.jpg)
56
Support
• Mailing lists » http://maven.apache.org/mail-lists.html
• IRC » irc.codehaus.org - #maven
• Forums » http://www.developpez.net/ forum maven » In French
• Dedicated support » Sonatype and many others companies
![Page 57: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/57.jpg)
57
QUESTIONS ? Apache Maven
![Page 58: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/58.jpg)
58
Licence et copyrights
• Photos and logos belong to their respective authors/owners
• Various ideas are coming from the excellent presentation done by Matthew McCullough : » http://www.slideshare.net/matthewmccullough/
maven-30-at-oredev
![Page 59: ToursJUG-Maven 3.x, will it lives up to its promises](https://reader033.vdocument.in/reader033/viewer/2022060109/5552f5e9b4c90587048b4dc3/html5/thumbnails/59.jpg)
59
Licence et copyrights
• Content under Creative Commons 3.0 » Attribution — You must attribute the work in the manner
specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
» Noncommercial — You may not use this work for commercial purposes.
» Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
• http://creativecommons.org/licenses/by-nc-sa/3.0/us/