You are on page 1of 134

Apache Maven - AlpesJUG - March 29th, 2010

Arnaud Héritier eXo Platform Software Factory Manager

Arnaud Héritier
● 

Software Factory Manager eXo platform
- 

In charge of tools and methods

● 

● 

Committer since 2004 and member of the Project Management Committee Coauthor of « Apache Maven » published by Pearson (in French)

Licensed under a Creative Commons license

Apache Maven

CHOOSE YOUR MENU

Licensed under a Creative Commons license

the corporate choice Competitors . that is the question ! -  -  -  Conventions POM Reactor and Modules Inheritance Artifact Repository Dependency Version Profiles Build Lifecycle And Plugins Licensed under a Creative Commons license Maven.Overview ●  ●  ●  Definition History Concepts -  -  -  -  -  -  -  -  -  ●  Maven or not Maven. the project choice Maven.

Ecosystem ●  ●  Repository Managers Quality Management -  -  -  -  ●  ●  Continuous Integration IDE -  -  -  Tests Automation Quality Metrics Reports Project Reports Sonar Eclipse Idea IntelliJ Netbeans Licensed under a Creative Commons license .

Good & Bad Practices ●  ●  ●  ●  K.I.S. Project Organization POM Development Licensed under a Creative Commons license .S.

Usecases ●  ●  ●  Secure your credentials Build a part of your project using reactor options Automate your release process -  (at least the technical part) Licensed under a Creative Commons license .

Back to the future ●  ●  ●  Maven 2.x Maven 3.x Community Licensed under a Creative Commons license .

Apache Maven OVERVIEW Licensed under a Creative Commons license .

reporting and documentation from a central piece of information. Licensed under a Creative Commons license .Definition ●  ●  Apache Maven is a software project management and comprehension tool. binaries. Based on the concept of a project object model (POM) -  Maven can manage a project's build.

History ●  ●  ●  ●  ●  Initiated in 2001 by Jason Van Zyl in Alexandria. an Apache Jakarta project. Maven 2.0 … coming soon !!! Licensed under a Creative Commons license . Moved to Turbine few months after.0 released in September 2005 Maven 3. Became a Top Level Project in 2003.

Apache Maven CONCEPTS Licensed under a Creative Commons license 12 .

java to compile in src/[main|test]/java *.xml. *. ear.Conventions ●  1 project = 1 artifact (pom. war. jar. …) Standardized -  ●  directories layout ●  ●  ●  *.properties needed in classpath and to bundle in archive in src/[main|test]/java … project descriptor (POM) -  build lifecycle -  Licensed under a Creative Commons license 13 .

POM ●  An XML file (pom.0" encoding="UTF-8"?>! <project>! <modelVersion>4..2</version>! </dependency>! .0..springframework</groupId>! <artifactId>spring-struts</artifactId>! <version>2.0.0</modelVersion>! ●  <groupId>net.1-SNAPSHOT</version>! <packaging>war</packaging>! <name>Simple webapp</name>! <inceptionYear>2007</inceptionYear>! <dependencies>! <dependency>! <groupId>org.! </dependencies>! </project>! Project identification Project version Project description Build settings Dependencies … Licensed under a Creative Commons license .aheritier.samples</groupId>! <artifactId>simple-webapp</artifactId>! <version>1.xml) Describing -  -  -  -  -  -  <?xml version="1.

Modules have to be defined in the POM -  <project>! ....Reactor ●  ●  ●  Split your project in sub-modules Maven computes the build order from dependencies between submodules.! <modules>! <module>moduleA</module>! <module>moduleB</module>! <module>moduleC</module>! <module>moduleD</module>! <module>moduleE</module> ! <module>moduleF</module>! </modules>! .! </project>! No auto-discovery for performance reasons Licensed under a Creative Commons license ..

aheritier.Inheritance ●  ●  Share settings between projects/modules By default the parent project is supposed to be in the parent directory (.0-SNAPSHOT<version>! </parent>! Licensed under a Creative Commons license ./) <parent>! <groupId>net.0..sample</groupId>! <artifactId>my-parent</artifactId>! <version>1.

Inheritance Use a technical inheritance to organize sub-modules Use assembly to package batchs Insert README in all artifacts Use clirr to validate backward compatibility Licensed under a Creative Commons license .

Artifact Repository ●  By default : -  A central repository ●  ●  http://repo1.m2/repository All artifacts -  -  -  -  A local repository ●  ●  Used by maven and its plugins Used by your projects (dependencies) Produced by your projects Licensed under a Creative Commons license .maven.home}/.org/ maven2 Several dozen of Gb of OSS libraries ${user.

Artifact Repository ●  ●  ●  By default Maven downloads artifacts required by the project or itself from central Downloaded artifacts are stored in the local repository Used to store : -  -  -  Project’s binaries Project’s dependencies Maven and plug-ins binaries Licensed under a Creative Commons license .

Dependencies Without Maven With Maven Licensed under a Creative Commons license .

war. … -  ●  Transitives Lib A needs Lib B -  Lib B needs Lib C -  Thus Lib A needs Lib C -  Licensed under a Creative Commons license .Dependencies ●  Declaratives groupId + artifactId + version (+ classifier) -  Type (packaging) : jar. ear. pom.

DbUnit. Driver SGBD.Dependencies ●  Scope Compile (by default) : Required to build and run the application -  Runtime : not required to build the application but needed at runtime -  ●  Ex : taglibs -  Provided : required to build the application but not needed at runtime (provided by the container) ●  Ex : Servlet API. … Ex : software products -  System : local library with absolute path ●  Licensed under a Creative Commons license . … -  Test : required to build and launch tests but not needed by the application itself to build and run ●  Ex : Junit. TestNG.

Dependencies ●  Define all dependencies you are using -  and no more ! Perhaps you should have optional modules instead mvn dependency:analyze! ●  If you have optional dependencies -  ●  Cleanup your dependencies with -  ●  Study your dependencies with -  mvn dependency:tree! -  mvn dependency:list! Licensed under a Creative Commons license .

Versions ●  ●  Project and dependency versions Two different version variants -  SNAPSHOT version ●  ●  ●  ●  The version number ends with –SNAPSHOT The project is in development Deliveries are changing over the time and are overridden after each build Artifacts are deployed with a timestamp on remote repositories The version number doesn’t end with –SNAPSHOT Binaries won’t change -  RELEASE version ●  ●  Licensed under a Creative Commons license .

Versions Licensed under a Creative Commons license .

The update policy defines the recurrence of checks if there is a new SNAPSHOT version available on the remote repository : ●  ●  ●  ●  always daily (by default) interval:X (a given period in minutes) never They can change thus the release also  The release plugin will enforce it  -  Must not be used in a released project ●  ●  Licensed under a Creative Commons license .Versions ●  About SNAPSHOT dependencies -  Maven allows the configuration of an update policy.

Licensed under a Creative Commons license .Versions ●  Range From … to … -  Maven automatically searches for the corresponding version (using the update policy for released artifacts) -  To use with caution -  ●  ●  Risk of non reproducibility of the build Risk of side effects on projects depending on yours.

B.C-SNAPSHOT! Licensed under a Creative Commons license .Versions ●  Use the versions plugin to update all versions of your project and its modules mvn versions:set –DnewVersion=A.

-profileId2 ! -P!profileId3! mvn <phases or goals> ! Licensed under a Creative Commons license .Profiles ●  ●  ●  Allow to modify the default behavior of Maven by overriding/adding some settings Use mvn help:active-profiles to debug Explicit activation or deactivation -PprofileId1.

..Profiles ●  ●  activeByDefault = If no other profile is activated Activation through Maven settings ..! <settings>! </settings>! Licensed under a Creative Commons license ..! <activeProfiles>! <activeProfile>profile-1</activeProfile>! </activeProfiles>! .

Profiles ●  Activation based on environment variables <profiles>! <profile>! <activation>! <property>! <name>!skip-enforce</name>! </property>! </activation>! .! </profile>! </profiles>! Licensed under a Creative Commons license .....! </profile>! </profiles>! <profiles>! <profile>! <activation>! <property>! <name>run-its</name>! <value>true</value>! </property>! </activation>! .

1.6)</jdk>! </activation>! ..! </profile>! </profiles>! .Profiles ●  OS / Java settings <profiles>! <profile>! <activation>! <os>! <name>Windows XP</name>! <family>Windows</family>! <arch>x86</arch>! <version>5.! </profile>! </profiles>! Licensed under a Creative Commons license <profiles>! <profile>! <activation>! <jdk>[1..1...3.2600</version>! </os>! </activation>! .

Profiles ●  Activation on present or missing files <profile>! <activation>! <file>! <missing>${project.build.directory}/generated-sources/ axistools/wsdl2java/</missing>! </file>! </activation>! ..! </profile>! <profiles>! </profiles>! Licensed under a Creative Commons license ..

Build Lifecycle And Plugins ●  ●  Plugin based architecture for a great extensibility Standardized lifecycle to build all types of archetypes Licensed under a Creative Commons license .

Build Lifecycle And Plugins Default Lifecycle validate initialize generate-sources process-sources generate-resources process-resources Clean Lifecycle pre-clean Site Lifecycle pre-site clean post-clean site post-site site-deploy compile process-classes generate-test-sources process-test-sources generate-test-resources process-test-resources test-compile process-test-classes test prepare-package package pre-integration-test integration-test post-integration-test verify install deploy Licensed under a Creative Commons license .

Build Lifecycle And Plugins ●  Many plugins Packaging -  Reporting -  IDE integration -  Miscellaneous tools integration -  ●  Many locations maven.org -  code.com -  … -  Licensed under a Creative Commons license .google.codehaus.org -  mojo.apache.

THAT IS THE QUESTION ! Licensed under a Creative Commons license .Apache Maven MAVEN OR NOT MAVEN.

the project’s choice ●  Application’s architecture The project has the freedom to divide the application in modules -  Maven doesn’t limit the evolution of the application architecture -  ●  Dependencies management Declarative : Maven automatically downloads them and builds the classpath -  Transitive : We define only what the module needs itself -  Licensed under a Creative Commons license .Maven.

Maven. tests. releases) One thing it cannot do for you : to develop  -  -  -  -  -  -  ●  Builds Tests Packages Deploys Documents Checks and reports about the quality of developments Licensed under a Creative Commons license . the project’s choice ●  Centralizes and automates all development facets (build.

the corporate’s choice ●  Widely adopted and known -  Many developers ●  ●  Developments are standardized Decrease of costs Reuse of knowledge -  Reuse of configuration fragments -  Reuse of process and code fragments -  ●  Product quality improvement -  Reports and monitoring Licensed under a Creative Commons license .Maven.

We tried on Maven 1 and it died because of that. Buildr… Script oriented -  You can do what you want ! ●  ●  Reuse many of Maven conventions (directories layout. -  It’s like providing a framework without public API  -  Licensed under a Creative Commons license .Competitors ●  ●  Ant + Ivy. Gant. It was impossible to create a set of tests to cover all usages. …) 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. Easy Ant. Gradle.

With scripts oriented builds
You can have But often you have

Licensed under a Creative Commons license

With Maven
We dream to deliver Maven 3.x ? But today we have too often Maven 2.x

Licensed under a Creative Commons license

Apache Maven

ECOSYSTEM

Licensed under a Creative Commons license

Maven’s ecosytem ●  ●  Maven alone is nothing You can integrate it with many tools A large set of plug-ins is already available -  You can define your own plug-ins -  Licensed under a Creative Commons license .

Apache Maven REPOSITORY MANAGERS Licensed under a Creative Commons license .

Repository Managers ●  Several products -  -  -  ●  Basic services -  -  -  -  -  Sonatype Nexus (replaced Proximity) Jfrog Artifactory Apache Archiva Search artifacts Browse repositories Proxy external repositories Host internal repositories Security Licensed under a Creative Commons license .

Secure your builds ●  Deploy a repository manager to proxy externals repositories to : Avoid external network outages -  Avoid external repository unavailabilities -  To reduce your company’s external network usage -  To increase the speed of artifact downloads -  ●  Additional services offered by such servers : Artifacts procurement to filter what is coming from the outside -  Staging repository to validate your release before deploying it -  Licensed under a Creative Commons license .

Nexus for productivity Licensed under a Creative Commons license .

Nexus for collaboration ●  ●  Deploy 3rd Party Artifacts Collaborate with Internal Repositories Distribute to the community with Public Repositories Distribute to customers with Private Repositories ●  ●  Licensed under a Creative Commons license .

Nexus for quality ●  ●  ●  ●  Ease the Burden on Central and others remote repositories Gain Predictability and Scalability Control and Audit Dependencies and Releases Stage releases Licensed under a Creative Commons license .

Apache Maven QUALITY MANAGEMENT Licensed under a Creative Commons license .

TestNG – unit tests. -  Selenium. -  Fitnesse. Canoo – web GUI test.Tests Automation ●  ●  Use automated tests as often as you can Many tools are available through Maven JUnit. -  SoapUI – web services tests -  JMeter – performances tests -  And many more frameworks are available to reply your needs -  Licensed under a Creative Commons license . Greenpepper – functional tests.

Clirr) -  Tests coverage (Cobertura. Clover) -  … -  -  ●  You can use blocking rules You can use reports For example.Quality Metrics ●  Extract quality metrics from your project and monitor them : Code style (CheckStyle) -  Bad practices or potential bugs (PMD. Emma. FindBugs. I break the build if the upward compatibility of public APIs is broken ●  Reports are available in a web site generated by Maven -  Or in a quality dashboard like Sonar -  Licensed under a Creative Commons license .

Dependency Report Licensed under a Creative Commons license .

Sonar. a quality dashboard Licensed under a Creative Commons license .

analyze your project Licensed under a Creative Commons license .Sonar.

Sonar. Continuous Improvement ? Licensed under a Creative Commons license .

Apache Maven CONTINUOUS INTEGRATION Licensed under a Creative Commons license .

Continuum. Bamboo.Continuous Integration ●  Setup a continuous integration server to : Have a neutral and unmodified environment to run your tests -  Quickly react when -  ●  ●  ●  The build fails (compilation failure for example) A test fails A quality metric is bad -  ●  Continuously improve the quality of your project and your productivity Hudson. Cruisecontrol. … Licensed under a Creative Commons license Many products -  . TeamCity.

Hudson. how the weather is ? Licensed under a Creative Commons license .

check Licensed under a Creative Commons license .Hudson : build. test.

Apache Maven IDE Licensed under a Creative Commons license .

Eclipse Licensed under a Creative Commons license .

Eclipse Licensed under a Creative Commons license .

Eclipse Licensed under a Creative Commons license .

Idea IntelliJ Licensed under a Creative Commons license .

Netbeans Licensed under a Creative Commons license .

Apache Maven GOOD & BAD PRACTICES Licensed under a Creative Commons license .

Apache Maven KISS Licensed under a Creative Commons license .

S.K. ●  ●  Keep It Simple.I. Stupid Start from scratch -  Do not copy/paste what you find without understanding It’s not because maven offers many features that you need to use them ●  ●  ●  ●  ●  Use only what you need -  Filtering Modules Profiles … Licensed under a Creative Commons license .S.

Apache Maven PROJECT ORGANIZATION GOOD & BAD PRACTICES Licensed under a Creative Commons license .

-  Except if they are not compatible with your IDE -  ●  Different versions in sub-modules -  In that case they are standalone projects. It makes the POMs maintenance more complex -  ●  Too many inheritance levels -  Where should I set this plugin parameter ? In which parent ? Licensed under a Creative Commons license .Project bad practices ●  Ignore Maven conventions Except if your are migrating from something else and the target has to be to follow them.

Project bad practices ●  Have too many modules -  Is there a good reason ? ●  ●  Technical constraint ? Team organization ? Many more artifacts to generate Dependencies resolution more complex More modules to import in your IDE More modules to update … -  It increases the build time ●  ●  -  It involves more complex developments ●  ●  Licensed under a Creative Commons license .

site distribution settings … Licensed under a Creative Commons license .Project good practices Use the default inheritance : -  -  ●  The reactor project is also the parent of its modules. Configuration is easier : ●  No need to redefine SCM settings.

Apache Maven POM GOOD & BAD PRACTICES Licensed under a Creative Commons license .

POM bad practices Dependencies : -  ●  ●  DON’T confuse dependencies and dependencyManagement Plugins : DON’T confuse plugins and pluginManagement -  DON’T use AntRun plugin everywhere -  DON’T let Maven choose plugins versions for you -  Licensed under a Creative Commons license .

POM bad practices ●  Profiles : DON’T create environment dependant builds -  DON’T rely on dependencies coming from profiles (there is no transitive activation of profiles) -  ●  Reporting and quality DON’T activate on an existing project all reports with default configuration -  DON’T control formatting rules without giving settings for IDEs. Licensed under a Creative Commons license . -  ●  DON’T put everything you find in your POM.

POM good practices ●  ●  ●  Set versions of dependencies in project parent’s dependencyManagement Set dependencies (groupId. scope) in each module they are used Use the dependency plugin (from apache) and versions plugin (from mojo) to analyze. cleanup and update your dependencies. artifactId. Licensed under a Creative Commons license .

Apache Maven DEVELOPMENT GOOD & BAD PRACTICES Licensed under a Creative Commons license .

DON’T always use "-Dmaven.Development bad practices ●  ●  ●  ●  DON’T spend your time in the terminal.test.skip=true” DON’T manually do releases Licensed under a Creative Commons license . DON’T exchange libraries through emails.

1 the time of dependencies/modules resolution decreased a lot (Initialization of a project of 150 modules passed from 8 minutes to less than 1) ●  Use the reactor plugin (Maven < 2.1) to rebuild only a subpart of your project : All modules depending on module XXX -  All modules used to build XXX -  ●  Try to not use Maven features not supported by your IDE (resources filtering with the plugin eclipse:eclipse) Licensed under a Creative Commons license .1) or native reactor command line options (Maven >= 2.Development good practices ●  Keep up-to-date your version of Maven -  For example in 2.

Apache Maven USECASES Licensed under a Creative Commons license .

Apache Maven SECURE YOUR CREDENTIALS Licensed under a Creative Commons license .

xml <settingssecurity>! <master>{dZPuZ74YTJ0HnWHGm4zgfDlruYQNda1xib9vAVf2vvY=}</master>! </settingssecurity>! Licensed under a Creative Commons license .Secure your credentials ●  Generate a private key 
 arnaud@leopard:~$ mvn --encrypt-master-password toto
 {dZPuZ74YTJ0HnWHGm4zgfDlruYQNda1xib9vAVf2vvY=}
 -  ●  We save the private key in ~/.m2/settings-security.


 <servers>
 ...
 </settings>! Licensed under a Creative Commons license .
 <server>
 <id>mon.server</id>
 <username>arnaud</username>
 <password>{SbC9Fl2jA4oHZtz5Fcefp2q1tMXEtBkz9QiKljPiHss=}</password>
 </server>
 ..m2/settings..xml</relocation>
 </settingssecurity>! Secure your credentials ●  You create an encrypted version of your server password arnaud@mbp-arnaud:~$ mvn --encrypt-password titi {SbC9Fl2jA4oHZtz5Fcefp2q1tMXEtBkz9QiKljPiHss=}! -  ●  -  You register it in your settings <settings>
 ...xml <settingssecurity>
 <relocation>/Volumes/ArnaudUsbKey/secure/settings-security..
 </servers>
 .●  -  You can move this key to another drive ~/..

Apache Maven BUILD A PART OF YOUR PROJECT Licensed under a Creative Commons license .

SUCCESS [0.462s]
 [INFO] ModuleE ....574s]
 [INFO] ModuleB ..................................1) -  arnaud@mbp-arnaud:~$ mvn install
 [INFO] ------------------------------------------------
 [INFO] Reactor Summary:
 [INFO]
 [INFO] Project ............132s]
 [INFO] ModuleA ............ SUCCESS [0........404s] ! ●  Builds everything from A to F Licensed under a Creative Commons license ............................ SUCCESS [0...........455s]
 [INFO] ModuleC .. SUCCESS [0...396s]
 [INFO] ModuleD ....... SUCCESS [2.723s]
 [INFO] ModuleF ....Reactor options (Maven > 2. SUCCESS [0........... SUCCESS [5...............................

.... SUCCESS [1.774s]
 [INFO] ModuleE ...moduleB
 [INFO] -------------------------------------------
 [INFO] Reactor Summary:
 [INFO]
 [INFO] ModuleB ........Reactor options (Maven > 2...1) -  arnaud@mbp-arnaud:~$ mvn install –pl moduleE................. SUCCESS [2....008s]
 ●  ●  ●  Builds only modules B and E Following dependencies order -pl --project-list: Build the specified reactor projects instead of all projects Licensed under a Creative Commons license .

.... … Licensed under a Creative Commons license .................1) -  arnaud@mbp-arnaud:~$ mvn install –pl moduleD -am
 [INFO] ------------------------------------------
 [INFO] Reactor Summary:
 [INFO]
 [INFO] ModuleA ................ SUCCESS [4. SUCCESS [0.Reactor options (Maven > 2..... also make projects that the list depends on Usecase : Build all modules required for a war.. SUCCESS [0...384s]
 ●  ●  ●  Builds module D (-pl) and all modules it uses as dependencies -am --also-make: If a project list is specified....... SUCCESS [0. ear.....354s]
 [INFO] ModuleD .........468s]
 [INFO] ModuleC ....075s]
 [INFO] ModuleB ..

.881s]
 [INFO] ModuleE .. SUCCESS [0.................Reactor options (Maven > 2..............427s]
 ●  ●  ●  Builds module D (-pl) and all modules which depend on it -amd --also-make-dependents: If a project list is specified....1) -  arnaud@mbp-arnaud:~$ mvn install –pl moduleD -amd
 [INFO] ------------------------------------------
 [INFO] Reactor Summary:
 [INFO]
 [INFO] ModuleD .478s]
 [INFO] ModuleF ...... SUCCESS [0.. SUCCESS [4.... also make projects that depend on projects on the list Usecase : Check that a change in a module didn’t break others which are using it Licensed under a Creative Commons license ......

Apache Maven RELEASE YOUR PROJECT Licensed under a Creative Commons license .

Release of a webapp in 2002 ●  Limited usage of eclipse No WTP (Only some features in WSAD). -  No ability to produce WARs -  Licensed under a Creative Commons license .

Release of a webapp in 2002 ●  Many manual tasks Modify settings files -  Package JARs -  Copy libraries (external and internal) in a « lib » directory -  Package WAR (often with a zip command) -  Tag the code (CVS) -  Send the package on the integration server using FTP -  Deploy the package with AS console -  Licensed under a Creative Commons license .

Release of a webapp in 2002 ●  One problem : The are always problems -  -  -  -  -  ●  How long did it take ? -  -  Error in config files Missing dependencies Missing file Last minute fix which created a bug And many other possibilies .. When everything is ok : 15 minutes When there’s a problem : ½ day or more Licensed under a Creative Commons license .

Licensed under a Creative Commons license .Maven Release Plugin ●  ●  Automates the release process from tagging sources to binaries delivery Release plugin main goals: Prepare : To update maven versions and information in POMs and tag the code -  Perform : To deploy binaries in a maven repository -  ●  After that you can just automate the deployment on the AS using cargo for example.

Maven Release Plugin Licensed under a Creative Commons license .

Configuration and Prerequisites ●  ●  Project version (must be a SNAPSHOT version) Dependencies and plugins versions mustn’t be SNAPSHOTs Licensed under a Creative Commons license .

exoplatform.SCM configuration ●  ●  SCM binaries have to be in the PATH SCM credentials have to already be stored or you have to pass them in command line with : –Dusername=XXX –Dpassword=XXX <scm> <connection> scm:svn:http://svn.org/projects/parent/trunk </developerConnection> <url> http://fisheye.exoplatform.exoplatform.org/browse/projects/parent/trunk </url> </scm> Licensed under a Creative Commons license .org/projects/parent/trunk </connection> <developerConnection> scm:svn:http://svn.

url}</url> </repository> .repo. </properties> </project> Licensed under a Creative Commons license .url> http://repository.exoplatform.releases.repo. .exoplatform. </distributionManagement> . .org</id> <url>${exo. .releases. .repo. <properties> <exo. .Distribution Management <project> <distributionManagement> <repository> <id>repository.releases.url> .org/content/repositories/exo-releases </exo. .

org</id> <username>aheritier</username> <password>{ABCDEFGHIJKLMNOPQRSTUVWYZ}</password> </server> </servers> </settings> Licensed under a Creative Commons license .Repository credentials <settings> <servers> <server> <!–.id must be the one used in distributionManagement --> <id>repository.exoplatform.

..Default Release Profile in Super POM <profile> <id>release-profile</id> <activation> <property> <name>performRelease</name> <value>true</value> </property> </activation> <build> <plugins> <!–. </plugins> </build> </profile> Licensed under a Creative Commons license .Configuration to generate sources and javadoc jars --> .

Custom release profile
<project> ... <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.0-beta-9</version> <configuration> <useReleaseProfile>false</useReleaseProfile> <arguments>-Pmyreleaseprofile</arguments> </configuration> </plugin> </plugins> </pluginManagement> </build> Licensed under a Creative Commons license ... <profiles> <profile> <id>myreleaseprofile</id> <build> <!-– what you want to customize the behavior of the build when you do a release --> </build> </profile> </profiles> ... </project>

Troubleshooting Releases
● 

Common errors during release:
Build with release profile was tested before and fails -  Local modifications -  Current version is not a SNAPSHOT -  SNAPSHOTs in dependencies and/or plugins -  Missing some configuration (scm, distribMgt, …) -  Tag already exists -  Unable to deploy project to the Repository -  Connection problems
- 

Licensed under a Creative Commons license

Apache Maven

BACK TO THE FUTURE

Licensed under a Creative Commons license

Apache Maven PRODUCT Licensed under a Creative Commons license .

0.11 No other release of 2.0.0.x in the future Licensed under a Creative Commons license .Apache Maven 2.x ●  ●  ●  bugs fix Last release : 2.

Apache Maven 2.1 Licensed under a Creative Commons license .2.x ●  ●  Evolutions.1 like Parallel downloads -  Encrypted passwords -  ●  Last release : 2. new features Several important new features in 2.

x projects ●  Licensed under a Creative Commons license .x ●  ●  Do not be afraid !!!!! Not final before at least one year Full compatibility with maven 2.Apache Maven 3.

Apache Maven 3.x ●  What’s new : How POMs are constructed -  How the lifecycle is executed -  How the plugin manager executes -  How artifacts are resolved -  How it can be embedded -  How dependency injection is done -  Licensed under a Creative Commons license .

x ●  What it will change for maven users ? Any-source POM -  Versionless parent elements -  Mixins : a compositional form of Maven POM configuration -  Better IDE integration -  Error & integrity reporting -  ●  ●  ●  Much improved error reporting where we will provide links to each identifiable problem we know of. There are currently 42 common things that can go wrong.Apache Maven 3. Don't allow builds where versions come from non-project sources like local settings and CLI parameters Don't allow builds where versions come from profiles that have to be activated manually Licensed under a Creative Commons license .

Apache Maven 3.x ●  What it will change for maven developers ? Lifecycle extension points -  Plugin extension points -  Incremental build support -  Queryable lifecycle -  Extensible reporting -  Licensed under a Creative Commons license .

x ●  New tools Tycho : OSGI. Eclipse -  Mvnsh -  Licensed under a Creative Commons license .Apache Maven 3.

Maven Shell Licensed under a Creative Commons license .

Apache Maven COMMUNITY Licensed under a Creative Commons license .

Users community ●  1780 subscribers on users mailing list ●  ●  ●  90 days statistics Number of subscribers in blue Number of messages per day in red Licensed under a Creative Commons license .

The web site Licensed under a Creative Commons license .

Dowloads ●  Per month downloads Licensed under a Creative Commons license .

The team ●  ●  ●  ●  60 committers. Several organizations like Sonatype. More than 30 active in 2009. A community less isolated : more interactions with Eclipse. Jetty. Licensed under a Creative Commons license . deliver resources and professional support.

Commit Statistics Licensed under a Creative Commons license .

Apache Maven CONCLUSION Licensed under a Creative Commons license .

It has an important and really active community of users and developers Many resources to learn to use it and a professional support are available A product probably far from being perfect but on rails for the future Many things to do -  We need you ! Licensed under a Creative Commons license .Conclusion ●  ●  ●  ●  ●  ●  Today. Maven is widely adopted in corporate environments. It provides many services.

Apache Maven QUESTIONS ? Licensed under a Creative Commons license .

Licence et copyrights
●  ● 

Photos and logos belong to their respective authors/owners 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). purposes.

Noncommercial — You may not use this work for commercial 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/

Licensed under a Creative Commons license

Apache Maven

TO GO FURTHER …

Licensed under a Creative Commons license

Apache Maven

DOCUMENTATIONS

Licensed under a Creative Commons license

org http://docs.codehaus.org/display/MAVENUSER ●  Project’s team wiki : -  ●  Project’s users wiki : -  Licensed under a Creative Commons license .org/display/MAVEN http://docs.apache.Some links ●  The main web site : -  http://maven.codehaus.

Books ●  Sonatype / O’Reilly : -  -  -  -  The Definitive Guide http://www.com/ books Free download Available in several languages ●  Soon in French Licensed under a Creative Commons license .sonatype.

Books ●  Exist Global -  -  -  Better builds with Maven http://www.maestrodev.com/ better-build-maven Free download Licensed under a Creative Commons license .

From beginners to experts. In French only Available on 20th November Licensed under a Creative Commons license .Books ●  Nicolas De loof Arnaud Héritier -  -  -  -  -  Published by Pearson Collection Référence Based on our own experiences with Maven.

Apache Maven SUPPORT Licensed under a Creative Commons license .

net/ forum maven -  In French -  ●  Dedicated support -  Sonatype and some others companies Licensed under a Creative Commons license .#maven ●  IRC -  ●  Forums http://www.org .developpez.codehaus.org/mail-lists.apache.html irc.Support ●  Mailing lists -  http://maven.

Apache Maven ANNEXE Licensed under a Creative Commons license .

exoplatform.Setup a global mirror <settings> <mirrors> <mirror> <!--This sends everything else to /public --> <id>global-mirror</id> <mirrorOf>external:*</mirrorOf> <url>http://repository.org/content/groups/all</url> </mirror> </mirrors> <profiles> <profile> <id>mirror</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to the repository manager via the mirror --> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!--make the profile active all the time --> <activeProfile>mirror</activeProfile> </activeProfiles> </settings> Licensed under a Creative Commons license .