SlideShare uma empresa Scribd logo
1 de 51
Baixar para ler offline
Introduction to project
industrialization using
Maven
YaJUG 06/10/2009


            Copyright © Pierre-Antoine Grégoire License Creative
            Commons 2.0
Event


   http://www.yajug.lu

   October 06 2009 Best Practices and Tools for your
   build environments




                      Copyright © Pierre-Antoine Grégoire License Creative
                                                             Commons 2.0
Speaker

   Pierre-Antoine Grégoire


   I.T.Architect at


   Occasional committer in open source projects


   Dislikes buzzwords (SOA, EDA…), likes to
    conceptualize and build architectures


   Thinks having fun and working seriously (both at the
    same time) should be mandatory!


                         Copyright © Pierre-Antoine Grégoire License Creative
                                                                Commons 2.0
Who are you?

   Who in the audience is currently coding at work?


   Who in the audience is managing the lucky coders?


   Who is already using Maven 2+?


   Who is planning on using it and came to have more
   information?




                         Copyright © Pierre-Antoine Grégoire License Creative
                                                                Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                            Textual content under Copyright © Pierre-Antoine
                                     Grégoire License Creative Commons 2.0
Software development is
            engineering

   Since the early days of modern
   engineering, automation of build
   processes has been the key to:
   
   Productivity improvements
   
   Quality insurance
   
   Failure-Proofing


   Why would software development
   be any different?



                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Software development is
            engineering

   How do you really enable automation of build?
   
   Build has to be reproducible
   
   Build has to produce the final production artifact
   
   Build has to be as easy to maintain as possible and well
       documented
   
   Build has to contribute to the standardization effort




                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                             Textual content under Copyright © Pierre-Antoine
                                      Grégoire License Creative Commons 2.0
A bit of history

   Software craftmens are lazy, so they are looking for
    efficiency (or the other way around… )
   
   One command line to launch for a build, OK
   
   Two command lines to launch for a build, BAD enough
   
   More… forget it…


   Disclaimer: I’m one of these lazy craftmen…




                          Copyright © Pierre-Antoine Grégoire License Creative
                                                                 Commons 2.0
A bit of history

   A simple script (.sh, .bat) is already a possible solution


   More advanced command-line tools have been available for
    a long time

   make created in 1977 at Bells Labs by Stuart Feldman
    
   Still very much used nowadays


   Apache Ant created by James Duncan Davidson
    
   Was at first a platform-independent build system for Tomcat
        because Sun’s build system for Servlet RI (From which
        Tomcat was derived) was specific to Solaris.
    
   Released separately in 2000


                             Copyright © Pierre-Antoine Grégoire License Creative
                                                                    Commons 2.0
A bit of history

   Two main categories in current tools


   Scripting tools
    
   Ant and derived (XML)
    
   Rake (Ruby based)
    
   Gradle (Groovy based)
    
   … many others


   Artifact oriented tools
    
   Maven
    
   Debian Package Creation


                         Copyright © Pierre-Antoine Grégoire License Creative
                                                                Commons 2.0
A bit of history

   Maven 1.x is now a 10 years old project, mostly
   motionless since 2007 (no insult intended to people
   still using it or committing to it)


   Maven 2.x is the de facto standard for Java and Java EE
   build
   
   Most open source projects are switching to Maven for
       their build system
   
   It’s now five years old




                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                             Textual content under Copyright © Pierre-Antoine
                                      Grégoire License Creative Commons 2.0
Why Maven?

   Nowadays, build tools are not really used by developers
    directly.


   IDEs are increasing their functionalities scope,
    
   Compilation is almost always done on the fly
   
   Package and server startup is monitored by rich Uis
   
   Step-by-step debugging is a killer feature


   Build tools like Maven 2 are used to build the package
    you will put into production! This should never be
    done by an IDE, nor by hand!

                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Why Maven?

   If you are not already using it:
    
   Now is the best moment to start being aware
    
   Maven is mature
    
   Maven is getting better and better
    
   Maven can be used online, offline, and in enterprise
        environment


   If you are already using it:
    
   Hang on! The best is yet to come!
    
   Focus on necessary things and don’t get frustrated by
        petty details

                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                             Textual content under Copyright © Pierre-Antoine
                                      Grégoire License Creative Commons 2.0
An introduction to Maven

   Maven 2 is a tool with multiple facets:
   
   a BUILD tool



   
   a DEPENDENCY MANAGEMENT tool



   
   a DOCUMENTATION tool




                          Copyright © Pierre-Antoine Grégoire License Creative
                                                                 Commons 2.0
An introduction to Maven
Project Object Model
           pom.xml




             mvn




            Generated artifacts (jar, war, ear…),
            Documentation, statistics (test results, quality
            metrics, javadoc, web site)…


                       Copyright © Pierre-Antoine Grégoire License Creative
                                                              Commons 2.0
An introduction to Maven

   A project can easily be cut into modules thanks to
   Maven 2


   By simply declaring project metadata and optionally
   configuring a few plug-ins, you can:
   
   Build your project (compile, generate sources…)
   
   Launch tests and gather results (Junit, TestNG,
       Selenium…etc)
   
   Package (Jar, War, Ejb, War…etc)
   
   Document and generate reports



                          Copyright © Pierre-Antoine Grégoire License Creative
                                                                 Commons 2.0
An introduction to Maven

   Project Object Model (POM)
   
   Basic project information
       
   groupId, artifactId, version…
       
   Inheritance, or Aggregation through sub-modules (we’ll
          explain the difference later on)
   
   Build section
       
   Project layout (sources and resources folders… etc)
       
   Build plugins configuration
   
   Reporting section
       
   Reports configuration
   
   Some other advanced environment settings

                             Copyright © Pierre-Antoine Grégoire License Creative
                                                                    Commons 2.0
An introduction to Maven

   A plug-in is made of a MOJO (Maven POJO) which is
    simply a java class with Maven-specific metadata.


   A plug-in can define goals and reports


   Goals can be called directly:
   
     mvn plugin:goal


   Goals can be bound to one or multiple phases


   Reports are used during site generation
   
     mvn site



                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
An introduction to Maven
Phase
         compile                       mojo

                                           mojo
           test

                                         mojo
         package                                                           Plug-ins


          install
                                                   mojo
                                           mojo
         deploy


                                  Mojos define Goals (fine
        Lifecycle
                                  grained tasks)
                    Copyright © Pierre-Antoine Grégoire License Creative
                                                           Commons 2.0
An introduction to Maven

   When you invoke a phase, Maven 2 will go through all
   the phases until the one specified, executing the bound
   goals:
   
     mvn package


                 compile                             compiler:compile



                       test                          surefire:test




                 package                             jar:jar

                              Copyright © Pierre-Antoine Grégoire License Creative
                                                                     Commons 2.0
An introduction to Maven

   There are many more phases than in previous examples
    in the default lifecycle


   By default, all the basic necessary plug-ins for the build
    phase are already bound to phases


   It is easy to have information about plugins:
    
     mvn help:describe


   So….. what’s left to do, and what’s all the fuss about
    the complexity of Maven 2?



                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
An introduction to Maven

   Dependencies: A blessing and a curse


   Blessing:
   
   almost all java build tools nowadays leverage the Maven
       2 repositories (cf. Ivy, Ant, Gradle…etc)
   
   easier to find/discover/use java libraries


   Curse:
   
   Transitive dependencies can rapidly trigger a
       dependency hell!
   
   Curse: Harder to stabilize builds


                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
An introduction to Maven

   What really made Maven different from other builds
    systems in the first place?


   REPOSITORIES!!!


   Before Maven, it was really hard to find java libraries,
    and harder to ensure a coherent use of these libraries
    (I’m saying hard, not impossible…)


   Nowadays, it’s still very hard to find some jars with a
    decent/coherent versioning (discretely winking in the
    general direction of Sun participants...), let alone to
    find their sources or javadocs
                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
An introduction to Maven
                                      Local
                                      repository
                                      Corporate
                                      repository/
                                      proxy
                                      Public
                                      repository




          Copyright © Pierre-Antoine Grégoire License Creative
                                                 Commons 2.0
An introduction to Maven

   Local repository:                                                              Local
                                                                                   repository

   
   Local cache for artifacts                                                   Corporate
                                                                                   repository/
                                                                                   proxy

   
   Local private sandbox                                                       Public
                                                                                   repository


   
   It should be possible to erase it
       regularly
   
   Very useful for offline builds


   By default in user home’s .m2/ folder


   Can be moved to another place through
    Maven 2 runtime’ settings.xml file


   $MAVEN_HOME/conf/settings.xml

                            Copyright © Pierre-Antoine Grégoire License Creative
                                                                   Commons 2.0
An introduction to Maven

   Corporate repository/proxy                                                    Local
                                                                                  repository

   
   Very useful tool                                                           Corporate
                                                                                  repository/
                                                                                  proxy

   
   The first necessary step towards a                                         Public
                                                                                  repository

       corporate use of maven


   Can be as simple as a corporate
   http server exposing a repository

   Even better: install a repository management tool
   
   Can proxy external repositories
   
   Can filter unwanted artifacts
   
   Build even without internet access! (well… at least for the
       repository management tool)

                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
An introduction to Maven

   Public repositories                                                          Local
                                                                                 repository

   
   Good for dependencies’ harvesting                                         Corporate
                                                                                 repository/
                                                                                 proxy

   
   Should be proxied in corporate                                            Public
                                                                                 repository

       environments… or even for your
       personal use!
   
   A lot of mis-configured
       dependencies
   
   A lot of alpha/beta Maven 2 plug-
       ins


   Be cautious when adding public
    repositories to a build process!

                          Copyright © Pierre-Antoine Grégoire License Creative
                                                                 Commons 2.0
An introduction to Maven
Other key features of Maven:


   POM Inheritance/Aggregation


   Archetypes


   Launching Tests


   … many more…




                        Copyright © Pierre-Antoine Grégoire License Creative
                                                               Commons 2.0
An introduction to Maven

   POM Inheritance vs. POM Aggregation
   
   POM Inheritance:
      
   a POM and all its parent POMs will be flattened at runtime
      
   In the end only one effective POM in memory
      
   This is mostly used to share common configuration
   
   POM Aggregation:
      
   declare modules in a given project
      
   If a command is issued against a project, it will be also issued
          against all its modules
      
   This is mostly used to organize builds and gather projects
          that should be built simultaneously


                            Copyright © Pierre-Antoine Grégoire License Creative
                                                                   Commons 2.0
An introduction to Maven

   Project Archetypes
   
   You can build template projects and make them available as
       artifacts in the repositories
   
   Allows to share best practices without neither inheritance
       nor aggregation
       
   mvn archetype:create-from-project
       
   mvn archetype:generate

   
   Many Archetypes already configured in the default catalog
   
   You can easily build a custom or corporate catalog
       mvn archetype:generate
       –DarchetypeCatalog=http://www.corporate.com/
          archetypes.xml


                            Copyright © Pierre-Antoine Grégoire License Creative
                                                                   Commons 2.0
An introduction to Maven
Launching Tests


   Maven 2 allows to launch various types of tests:
   
   Unit tests: Junit 3.x or 4.x, TestNG, …
   
   UI Tests: Selenium, Canoo Webtest
   
   Functional tests: Fitnesse, Greenpepper
   
   WebServices tests: SOAPUi
   
   And many more…




                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                             Textual content under Copyright © Pierre-Antoine
                                      Grégoire License Creative Commons 2.0
Drawbacks of Maven

   If you don’t embrace the standardization brought by
   Maven 2, you’ll soon feel limited by Maven 2


   Additionally, standardization can be quite expensive!
   Measure the implied cost by testing on 2 subsequent
   projects (one to absorb the POC effect, and one for
   measure)


   By default Maven 2 has its own folder structure
   normalization, unknown to IDEs (though this is not
   completely true anymore)


   Last but not least: Maven 2 error reporting is SO
   BAAAAD!
                         Copyright © Pierre-Antoine Grégoire License Creative
                                                                Commons 2.0
Worst practices
You want more drawbacks? GET MORE OF THEM!


   Use maven-antrun-plugin a lot!
   
   So coool, this way you can use Maven and not Ant!


   Build very intricated projects with modules having
    modules themselves, and lots of inheritances all around!
   
   Niiice! This allows you to spend more time with your
       favorite tool: Maven 2 in order to find out where your
       damn properties/dependencies are defined!


   Replace your IDE with Maven and try to add all of your
    IDE’s functionalities as Maven plugins!!!!!
   
   You got my point ;)
                             Copyright © Pierre-Antoine Grégoire License Creative
                                                                    Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                             Textual content under Copyright © Pierre-Antoine
                                      Grégoire License Creative Commons 2.0
Best practices
They will allow you to overcome Maven 2’s drawbacks


   Embrace the standardization brought by Maven 2, don’t
    fight it


   Use POM Inheritance and <dependencyManagement>
    (with import scope), <pluginManagement>      to tame the
    transitive dependencies. (don’t mistake these for
    <dependencies>, <plugins>…)


   Use a Repository Manager:
    
   Sonatype Nexus: http://nexus.sonatype.org
   
   Jfrog Artifactory: http://artifactory.jfrog.org
   
   …                    Copyright © Pierre-Antoine Grégoire License Creative
                                                                   Commons 2.0
Best practices

   Don’t use Maven’s integrated reporting anymore
   
   It was meant for Apache project’s web sites static
       documentation
   
   The amount of time spent in order to build them is not
       worth it in enterprise environment


   Keep your build as simple as possible


   Generate test statistics data and other metrics data in
    order to exploit them in Software quality tools:
   
   Sonar: http://sonar.codehaus.org
   
   Squale: http://www.squale.org
   
   …
                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Best practices

   If you provide a standard environment, try to make
   Maven plugins have a match in the IDE
   
   If Maven 2 launches Checkstyle, provide the Checkstyle
       Eclipse plugin to your projects.


   Launch your builds regularly and possibly in a neutral
   zone (not on the developer’s desktop!) in order to ensure
   “rule number one” is respected: Build must be
   reproducible.


   Use the “dependency” and “versions” plugins to handle
   dependencies and diagnose dependencies mismatches or
   errors
                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Best practices

   Documentation and information:
   
   Site http://maven.apache.org
   
   Plugins
      
   http://maven.apache.org/plugins
      
   http://mojo.codehaus.org/
      
   http://code.google.com/
      
   And many others…
   
   Project Wiki http://docs.codehaus.org/display/MAVEN/
   
   Users’ Wiki
      http://docs.codehaus.org/display/MAVENUSER



                          Copyright © Pierre-Antoine Grégoire License Creative
                                                                 Commons 2.0
Best practices

   Books
   
   Free electronic editions:
   
   Definitive Guide: http://www.sonatype.com/books
   
   Better Builds with Maven:
       http://www.maestrodev.com/better-build-maven
   
   Upcoming book by Arnaud Héritier and Nicolas De Loof
       http://www.pearson.fr/livre/?GCOI=27440100730370




                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Planning

   Software development is engineering


   A bit of history


   Why Maven?


   An introduction to Maven


   Drawbacks of Maven


   Best practices


   Maven 3.x preview


   Maven in a Software development suite

                             Textual content under Copyright © Pierre-Antoine
                                      Grégoire License Creative Commons 2.0
Maven 3.x Preview

   DISCLAIMER!!!


   Everything mentioned here could end up being
    COMPLETELY FALSE!!! (though project is now well
    advanced)




                       Copyright © Pierre-Antoine Grégoire License Creative
                                                              Commons 2.0
Maven 3.x Preview

   New release planned for this autumn/winter


   Lots of refactorings of the insides of Maven 2
    
   Not immediately obvious (in a way this is better than the
        complete product change between Maven 1 and 2)
    
   Will allow to tackle upcoming challenges and regular
        issues of Maven 2 in a more elegant manner
    
   Simplifies plug-in development


   Efficient embedder
    
   Maven 2 has lots of singletons and such and is therefore
        improper for use in multithreaded environments (CIM,
        IDE)
                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Maven 3.x Preview

   Backward compatibility
   
   Loads of Integration testing is done to ensure backwards
       compatibility
   
   Stricter validation of the POM
   
   Configured plugins should have their versions specified (a
       warning appears otherwise)


   Site/reporting is now completely extracted from the
   Maven core
   
   Currently the Site plugin doesn’t work with Maven 3, yet
       should until the final release (though reports still work)
   
   Recommended to switch to the use of external quality
       monitoring tools
                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0
Maven 3.x Preview

   If you plan to migrate or want to evaluate:
    http://cwiki.apache.org/confluence/display/MAVEN/
    Maven+3.x+Compatibility+Notes

   Presentation by Jason van Zyl (Sonatype)
    http://www.scribd.com/doc/14458957/Jasons-Maven-3-
    Presentation


   My first impressions:
   
   Maven 3 looks awesome!
   
   Embedder is a killer feature
       
   The IDE can literally listen for the Build process, and be part
          of it, not just launch it.
                              Copyright © Pierre-Antoine Grégoire License Creative
                                                                     Commons 2.0
Maven 3.x Preview

   What will be new to users:
   
   Versionless parent elements
   
   Better version delegation
   
   Better error and integrity reporting
   
   XML Pom format using attributes instead of elements
   
   Scripted POM Formats (pom.{rb|groovy|py})


   What will be new to plugin developers:
   
   Plugin extension points
   
   Annotations instead of old javadoc tags
   
   Lifecycle extension points
   
   Queryable lifecycle
                             Copyright © Pierre-Antoine Grégoire License Creative
                                                                    Commons 2.0
Maven in a Software
          development suite

   Maven is now very well integrated in IDEs
   
   NetBeans 6.5+ now has very good support for Maven 2
   
   Eclipse 3.x has very good support also, with preview of
       Maven 3.x embedder (blazingly fast!)
   
   IntelliJ IDEA seems to have excellent support also (though
       this is why you pay for it isn’t it?)


   Maven works very well with Quality monitoring tools


   Maven 3 will most likely increase the embedding of
   Maven and its use for other JVM Languages and possibly
   for other platforms
                          Copyright © Pierre-Antoine Grégoire License Creative
                                                                 Commons 2.0
References and Thanks

   Many thanks to Arnaud Héritier
   
   He allowed me to be inspired by some of its recent slides
       presented to the French Ch’ti JUG
   http://blog.aheritier.net

   
   He also was kind enough to review this presentation ;)


   Many thanks to Jason van Zyl for its Maven 3
   presentation I was heavily inspired by
   http://www.sonatype.com/people/author/jason

                           Copyright © Pierre-Antoine Grégoire License Creative
                                                                  Commons 2.0

Mais conteúdo relacionado

Destaque

TechGenies Company Overview Sep 2016
TechGenies Company Overview Sep 2016TechGenies Company Overview Sep 2016
TechGenies Company Overview Sep 2016TechGenies LLC
 
Papilla Company Introduction
Papilla Company IntroductionPapilla Company Introduction
Papilla Company IntroductionMohd Rizalman
 
TeamThink company introduction_English
TeamThink company introduction_EnglishTeamThink company introduction_English
TeamThink company introduction_EnglishWeert Jacobsen Kramer
 
Route2 Company Introduction 25.07.11
Route2 Company Introduction 25.07.11Route2 Company Introduction 25.07.11
Route2 Company Introduction 25.07.11Route2 Sustainability
 
Introduction to Project Management
Introduction to Project ManagementIntroduction to Project Management
Introduction to Project ManagementSlav Karaslavov
 
Delta Galil Company Overview June 2016
Delta Galil Company Overview June 2016 Delta Galil Company Overview June 2016
Delta Galil Company Overview June 2016 Factstories
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 
Project Management Cycle and MS Project 2013 By Subodh Kumar PMP
Project Management Cycle and  MS Project 2013  By Subodh Kumar PMPProject Management Cycle and  MS Project 2013  By Subodh Kumar PMP
Project Management Cycle and MS Project 2013 By Subodh Kumar PMPSubodh Kumar
 
10 Usability Heuristics explained
10 Usability Heuristics explained10 Usability Heuristics explained
10 Usability Heuristics explainedCraft Design
 
Reuters institute Digital News Report 2014, Tracking the future of news
Reuters institute Digital News Report 2014, Tracking the future of newsReuters institute Digital News Report 2014, Tracking the future of news
Reuters institute Digital News Report 2014, Tracking the future of newsNic Newman
 
The Language of Discovery: Designing Big Data Interactions
The Language of Discovery: Designing Big Data InteractionsThe Language of Discovery: Designing Big Data Interactions
The Language of Discovery: Designing Big Data InteractionsJoe Lamantia
 
Introducing Apple Watch
Introducing Apple WatchIntroducing Apple Watch
Introducing Apple WatchJJ Wu
 

Destaque (15)

TechGenies Company Overview Sep 2016
TechGenies Company Overview Sep 2016TechGenies Company Overview Sep 2016
TechGenies Company Overview Sep 2016
 
Papilla Company Introduction
Papilla Company IntroductionPapilla Company Introduction
Papilla Company Introduction
 
TeamThink company introduction_English
TeamThink company introduction_EnglishTeamThink company introduction_English
TeamThink company introduction_English
 
The Continuous Update Project: Introduction to the Project
The Continuous Update Project: Introduction to the ProjectThe Continuous Update Project: Introduction to the Project
The Continuous Update Project: Introduction to the Project
 
Route2 Company Introduction 25.07.11
Route2 Company Introduction 25.07.11Route2 Company Introduction 25.07.11
Route2 Company Introduction 25.07.11
 
Lean implementation proposal ver 2
Lean implementation proposal  ver 2Lean implementation proposal  ver 2
Lean implementation proposal ver 2
 
Introduction to Project Management
Introduction to Project ManagementIntroduction to Project Management
Introduction to Project Management
 
Delta Galil Company Overview June 2016
Delta Galil Company Overview June 2016 Delta Galil Company Overview June 2016
Delta Galil Company Overview June 2016
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
Project Management Cycle and MS Project 2013 By Subodh Kumar PMP
Project Management Cycle and  MS Project 2013  By Subodh Kumar PMPProject Management Cycle and  MS Project 2013  By Subodh Kumar PMP
Project Management Cycle and MS Project 2013 By Subodh Kumar PMP
 
10 Usability Heuristics explained
10 Usability Heuristics explained10 Usability Heuristics explained
10 Usability Heuristics explained
 
Reuters institute Digital News Report 2014, Tracking the future of news
Reuters institute Digital News Report 2014, Tracking the future of newsReuters institute Digital News Report 2014, Tracking the future of news
Reuters institute Digital News Report 2014, Tracking the future of news
 
The Language of Discovery: Designing Big Data Interactions
The Language of Discovery: Designing Big Data InteractionsThe Language of Discovery: Designing Big Data Interactions
The Language of Discovery: Designing Big Data Interactions
 
Introducing Apple Watch
Introducing Apple WatchIntroducing Apple Watch
Introducing Apple Watch
 

Semelhante a Introduction to project industrialization with Maven 2

Project-Builder.org Presentation
Project-Builder.org PresentationProject-Builder.org Presentation
Project-Builder.org Presentationguestdd2966
 
An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to MavenJoao Pereira
 
Apache Maven at GenevaJUG by Arnaud Héritier
Apache Maven at GenevaJUG by Arnaud HéritierApache Maven at GenevaJUG by Arnaud Héritier
Apache Maven at GenevaJUG by Arnaud HéritierGenevaJUG
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 featuresAngel Ruiz
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOpsOmid Vahdaty
 
Introduction to Aptana
Introduction to Aptana Introduction to Aptana
Introduction to Aptana Kevin III
 
JDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile TeamsJDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile TeamsWojciech Seliga
 
Maven introduction
Maven introductionMaven introduction
Maven introductionLai Hieu
 
Mozilla Jetpack SDK - LinuxTag 2010
Mozilla Jetpack SDK - LinuxTag 2010Mozilla Jetpack SDK - LinuxTag 2010
Mozilla Jetpack SDK - LinuxTag 2010Brian King
 
E D - Environmental Dependencies in Python
E D - Environmental Dependencies in PythonE D - Environmental Dependencies in Python
E D - Environmental Dependencies in PythonAdam Englander
 
Kubernetes in the wild
Kubernetes in the wildKubernetes in the wild
Kubernetes in the wildsection_io
 
Apache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyApache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyVolodymyr Ostapiv
 

Semelhante a Introduction to project industrialization with Maven 2 (20)

Project-Builder.org Presentation
Project-Builder.org PresentationProject-Builder.org Presentation
Project-Builder.org Presentation
 
OSGi In A Nutshell
OSGi In A NutshellOSGi In A Nutshell
OSGi In A Nutshell
 
An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to Maven
 
Apache Maven at GenevaJUG by Arnaud Héritier
Apache Maven at GenevaJUG by Arnaud HéritierApache Maven at GenevaJUG by Arnaud Héritier
Apache Maven at GenevaJUG by Arnaud Héritier
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Introduction to Aptana
Introduction to Aptana Introduction to Aptana
Introduction to Aptana
 
Maven ppt
Maven pptMaven ppt
Maven ppt
 
JDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile TeamsJDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile Teams
 
SWT Lab 1
SWT Lab 1SWT Lab 1
SWT Lab 1
 
Maven introduction
Maven introductionMaven introduction
Maven introduction
 
Mozilla Jetpack SDK - LinuxTag 2010
Mozilla Jetpack SDK - LinuxTag 2010Mozilla Jetpack SDK - LinuxTag 2010
Mozilla Jetpack SDK - LinuxTag 2010
 
Build server
Build serverBuild server
Build server
 
E D - Environmental Dependencies in Python
E D - Environmental Dependencies in PythonE D - Environmental Dependencies in Python
E D - Environmental Dependencies in Python
 
J.unit.action.2
J.unit.action.2J.unit.action.2
J.unit.action.2
 
Maven.pptx
Maven.pptxMaven.pptx
Maven.pptx
 
Exploring MTJ
Exploring MTJExploring MTJ
Exploring MTJ
 
Kubernetes in the wild
Kubernetes in the wildKubernetes in the wild
Kubernetes in the wild
 
Maven 3 New Features
Maven 3 New FeaturesMaven 3 New Features
Maven 3 New Features
 
Apache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyApache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT Academy
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Introduction to project industrialization with Maven 2

  • 1. Introduction to project industrialization using Maven YaJUG 06/10/2009 Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 2. Event   http://www.yajug.lu   October 06 2009 Best Practices and Tools for your build environments Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 3. Speaker   Pierre-Antoine Grégoire   I.T.Architect at   Occasional committer in open source projects   Dislikes buzzwords (SOA, EDA…), likes to conceptualize and build architectures   Thinks having fun and working seriously (both at the same time) should be mandatory! Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 4. Who are you?   Who in the audience is currently coding at work?   Who in the audience is managing the lucky coders?   Who is already using Maven 2+?   Who is planning on using it and came to have more information? Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 5. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 6. Software development is engineering   Since the early days of modern engineering, automation of build processes has been the key to:   Productivity improvements   Quality insurance   Failure-Proofing   Why would software development be any different? Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 7. Software development is engineering   How do you really enable automation of build?   Build has to be reproducible   Build has to produce the final production artifact   Build has to be as easy to maintain as possible and well documented   Build has to contribute to the standardization effort Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 8. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 9. A bit of history   Software craftmens are lazy, so they are looking for efficiency (or the other way around… )   One command line to launch for a build, OK   Two command lines to launch for a build, BAD enough   More… forget it…   Disclaimer: I’m one of these lazy craftmen… Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 10. A bit of history   A simple script (.sh, .bat) is already a possible solution   More advanced command-line tools have been available for a long time   make created in 1977 at Bells Labs by Stuart Feldman   Still very much used nowadays   Apache Ant created by James Duncan Davidson   Was at first a platform-independent build system for Tomcat because Sun’s build system for Servlet RI (From which Tomcat was derived) was specific to Solaris.   Released separately in 2000 Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 11. A bit of history   Two main categories in current tools   Scripting tools   Ant and derived (XML)   Rake (Ruby based)   Gradle (Groovy based)   … many others   Artifact oriented tools   Maven   Debian Package Creation Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 12. A bit of history   Maven 1.x is now a 10 years old project, mostly motionless since 2007 (no insult intended to people still using it or committing to it)   Maven 2.x is the de facto standard for Java and Java EE build   Most open source projects are switching to Maven for their build system   It’s now five years old Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 13. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 14. Why Maven?   Nowadays, build tools are not really used by developers directly.   IDEs are increasing their functionalities scope,   Compilation is almost always done on the fly   Package and server startup is monitored by rich Uis   Step-by-step debugging is a killer feature   Build tools like Maven 2 are used to build the package you will put into production! This should never be done by an IDE, nor by hand! Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 15. Why Maven?   If you are not already using it:   Now is the best moment to start being aware   Maven is mature   Maven is getting better and better   Maven can be used online, offline, and in enterprise environment   If you are already using it:   Hang on! The best is yet to come!   Focus on necessary things and don’t get frustrated by petty details Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 16. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 17. An introduction to Maven   Maven 2 is a tool with multiple facets:   a BUILD tool   a DEPENDENCY MANAGEMENT tool   a DOCUMENTATION tool Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 18. An introduction to Maven Project Object Model pom.xml mvn Generated artifacts (jar, war, ear…), Documentation, statistics (test results, quality metrics, javadoc, web site)… Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 19. An introduction to Maven   A project can easily be cut into modules thanks to Maven 2   By simply declaring project metadata and optionally configuring a few plug-ins, you can:   Build your project (compile, generate sources…)   Launch tests and gather results (Junit, TestNG, Selenium…etc)   Package (Jar, War, Ejb, War…etc)   Document and generate reports Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 20. An introduction to Maven   Project Object Model (POM)   Basic project information   groupId, artifactId, version…   Inheritance, or Aggregation through sub-modules (we’ll explain the difference later on)   Build section   Project layout (sources and resources folders… etc)   Build plugins configuration   Reporting section   Reports configuration   Some other advanced environment settings Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 21. An introduction to Maven   A plug-in is made of a MOJO (Maven POJO) which is simply a java class with Maven-specific metadata.   A plug-in can define goals and reports   Goals can be called directly:   mvn plugin:goal   Goals can be bound to one or multiple phases   Reports are used during site generation   mvn site Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 22. An introduction to Maven Phase compile mojo mojo test mojo package Plug-ins install mojo mojo deploy Mojos define Goals (fine Lifecycle grained tasks) Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 23. An introduction to Maven   When you invoke a phase, Maven 2 will go through all the phases until the one specified, executing the bound goals:   mvn package compile compiler:compile test surefire:test package jar:jar Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 24. An introduction to Maven   There are many more phases than in previous examples in the default lifecycle   By default, all the basic necessary plug-ins for the build phase are already bound to phases   It is easy to have information about plugins:   mvn help:describe   So….. what’s left to do, and what’s all the fuss about the complexity of Maven 2? Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 25. An introduction to Maven   Dependencies: A blessing and a curse   Blessing:   almost all java build tools nowadays leverage the Maven 2 repositories (cf. Ivy, Ant, Gradle…etc)   easier to find/discover/use java libraries   Curse:   Transitive dependencies can rapidly trigger a dependency hell!   Curse: Harder to stabilize builds Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 26. An introduction to Maven   What really made Maven different from other builds systems in the first place?   REPOSITORIES!!!   Before Maven, it was really hard to find java libraries, and harder to ensure a coherent use of these libraries (I’m saying hard, not impossible…)   Nowadays, it’s still very hard to find some jars with a decent/coherent versioning (discretely winking in the general direction of Sun participants...), let alone to find their sources or javadocs Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 27. An introduction to Maven Local repository Corporate repository/ proxy Public repository Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 28. An introduction to Maven   Local repository: Local repository   Local cache for artifacts Corporate repository/ proxy   Local private sandbox Public repository   It should be possible to erase it regularly   Very useful for offline builds   By default in user home’s .m2/ folder   Can be moved to another place through Maven 2 runtime’ settings.xml file   $MAVEN_HOME/conf/settings.xml Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 29. An introduction to Maven   Corporate repository/proxy Local repository   Very useful tool Corporate repository/ proxy   The first necessary step towards a Public repository corporate use of maven   Can be as simple as a corporate http server exposing a repository   Even better: install a repository management tool   Can proxy external repositories   Can filter unwanted artifacts   Build even without internet access! (well… at least for the repository management tool) Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 30. An introduction to Maven   Public repositories Local repository   Good for dependencies’ harvesting Corporate repository/ proxy   Should be proxied in corporate Public repository environments… or even for your personal use!   A lot of mis-configured dependencies   A lot of alpha/beta Maven 2 plug- ins   Be cautious when adding public repositories to a build process! Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 31. An introduction to Maven Other key features of Maven:   POM Inheritance/Aggregation   Archetypes   Launching Tests   … many more… Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 32. An introduction to Maven   POM Inheritance vs. POM Aggregation   POM Inheritance:   a POM and all its parent POMs will be flattened at runtime   In the end only one effective POM in memory   This is mostly used to share common configuration   POM Aggregation:   declare modules in a given project   If a command is issued against a project, it will be also issued against all its modules   This is mostly used to organize builds and gather projects that should be built simultaneously Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 33. An introduction to Maven   Project Archetypes   You can build template projects and make them available as artifacts in the repositories   Allows to share best practices without neither inheritance nor aggregation   mvn archetype:create-from-project   mvn archetype:generate   Many Archetypes already configured in the default catalog   You can easily build a custom or corporate catalog mvn archetype:generate –DarchetypeCatalog=http://www.corporate.com/ archetypes.xml Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 34. An introduction to Maven Launching Tests   Maven 2 allows to launch various types of tests:   Unit tests: Junit 3.x or 4.x, TestNG, …   UI Tests: Selenium, Canoo Webtest   Functional tests: Fitnesse, Greenpepper   WebServices tests: SOAPUi   And many more… Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 35. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 36. Drawbacks of Maven   If you don’t embrace the standardization brought by Maven 2, you’ll soon feel limited by Maven 2   Additionally, standardization can be quite expensive! Measure the implied cost by testing on 2 subsequent projects (one to absorb the POC effect, and one for measure)   By default Maven 2 has its own folder structure normalization, unknown to IDEs (though this is not completely true anymore)   Last but not least: Maven 2 error reporting is SO BAAAAD! Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 37. Worst practices You want more drawbacks? GET MORE OF THEM!   Use maven-antrun-plugin a lot!   So coool, this way you can use Maven and not Ant!   Build very intricated projects with modules having modules themselves, and lots of inheritances all around!   Niiice! This allows you to spend more time with your favorite tool: Maven 2 in order to find out where your damn properties/dependencies are defined!   Replace your IDE with Maven and try to add all of your IDE’s functionalities as Maven plugins!!!!!   You got my point ;) Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 38. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 39. Best practices They will allow you to overcome Maven 2’s drawbacks   Embrace the standardization brought by Maven 2, don’t fight it   Use POM Inheritance and <dependencyManagement> (with import scope), <pluginManagement> to tame the transitive dependencies. (don’t mistake these for <dependencies>, <plugins>…)   Use a Repository Manager:   Sonatype Nexus: http://nexus.sonatype.org   Jfrog Artifactory: http://artifactory.jfrog.org   … Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 40. Best practices   Don’t use Maven’s integrated reporting anymore   It was meant for Apache project’s web sites static documentation   The amount of time spent in order to build them is not worth it in enterprise environment   Keep your build as simple as possible   Generate test statistics data and other metrics data in order to exploit them in Software quality tools:   Sonar: http://sonar.codehaus.org   Squale: http://www.squale.org   … Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 41. Best practices   If you provide a standard environment, try to make Maven plugins have a match in the IDE   If Maven 2 launches Checkstyle, provide the Checkstyle Eclipse plugin to your projects.   Launch your builds regularly and possibly in a neutral zone (not on the developer’s desktop!) in order to ensure “rule number one” is respected: Build must be reproducible.   Use the “dependency” and “versions” plugins to handle dependencies and diagnose dependencies mismatches or errors Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 42. Best practices   Documentation and information:   Site http://maven.apache.org   Plugins   http://maven.apache.org/plugins   http://mojo.codehaus.org/   http://code.google.com/   And many others…   Project Wiki http://docs.codehaus.org/display/MAVEN/   Users’ Wiki http://docs.codehaus.org/display/MAVENUSER Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 43. Best practices   Books   Free electronic editions:   Definitive Guide: http://www.sonatype.com/books   Better Builds with Maven: http://www.maestrodev.com/better-build-maven   Upcoming book by Arnaud Héritier and Nicolas De Loof http://www.pearson.fr/livre/?GCOI=27440100730370 Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 44. Planning   Software development is engineering   A bit of history   Why Maven?   An introduction to Maven   Drawbacks of Maven   Best practices   Maven 3.x preview   Maven in a Software development suite Textual content under Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 45. Maven 3.x Preview   DISCLAIMER!!!   Everything mentioned here could end up being COMPLETELY FALSE!!! (though project is now well advanced) Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 46. Maven 3.x Preview   New release planned for this autumn/winter   Lots of refactorings of the insides of Maven 2   Not immediately obvious (in a way this is better than the complete product change between Maven 1 and 2)   Will allow to tackle upcoming challenges and regular issues of Maven 2 in a more elegant manner   Simplifies plug-in development   Efficient embedder   Maven 2 has lots of singletons and such and is therefore improper for use in multithreaded environments (CIM, IDE) Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 47. Maven 3.x Preview   Backward compatibility   Loads of Integration testing is done to ensure backwards compatibility   Stricter validation of the POM   Configured plugins should have their versions specified (a warning appears otherwise)   Site/reporting is now completely extracted from the Maven core   Currently the Site plugin doesn’t work with Maven 3, yet should until the final release (though reports still work)   Recommended to switch to the use of external quality monitoring tools Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 48. Maven 3.x Preview   If you plan to migrate or want to evaluate: http://cwiki.apache.org/confluence/display/MAVEN/ Maven+3.x+Compatibility+Notes   Presentation by Jason van Zyl (Sonatype) http://www.scribd.com/doc/14458957/Jasons-Maven-3- Presentation   My first impressions:   Maven 3 looks awesome!   Embedder is a killer feature   The IDE can literally listen for the Build process, and be part of it, not just launch it. Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 49. Maven 3.x Preview   What will be new to users:   Versionless parent elements   Better version delegation   Better error and integrity reporting   XML Pom format using attributes instead of elements   Scripted POM Formats (pom.{rb|groovy|py})   What will be new to plugin developers:   Plugin extension points   Annotations instead of old javadoc tags   Lifecycle extension points   Queryable lifecycle Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 50. Maven in a Software development suite   Maven is now very well integrated in IDEs   NetBeans 6.5+ now has very good support for Maven 2   Eclipse 3.x has very good support also, with preview of Maven 3.x embedder (blazingly fast!)   IntelliJ IDEA seems to have excellent support also (though this is why you pay for it isn’t it?)   Maven works very well with Quality monitoring tools   Maven 3 will most likely increase the embedding of Maven and its use for other JVM Languages and possibly for other platforms Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0
  • 51. References and Thanks   Many thanks to Arnaud Héritier   He allowed me to be inspired by some of its recent slides presented to the French Ch’ti JUG http://blog.aheritier.net   He also was kind enough to review this presentation ;)   Many thanks to Jason van Zyl for its Maven 3 presentation I was heavily inspired by http://www.sonatype.com/people/author/jason Copyright © Pierre-Antoine Grégoire License Creative Commons 2.0