SlideShare a Scribd company logo
1 of 40
An Introduction to Apache




                            Author: Vadim Lotar (QC Backend)
                                                        2011
Agenda
 Automation Build Tool
 A bit of history
 Why Maven?
 An Introduction to Maven
 Drawbacks of Maven
 Best practices
 Maven in software development suite
 Examples
 Q&A
Automation Build Tool
   Since the early days of modern
    engineering, automation of build
    processes has been the key to:

     Productivity improvements
     Quality insurance
     Eliminate dependencies on key
      personnel
     Save time and money


   Why would software development
    be any different?
Automation Build Tool
   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
Agenda
 Automation Build Tool
 A bit of history
 Why Maven?
 An Introduction to Maven
 Drawbacks of Maven
 Best practices
 Maven in software development suite
 Examples
 Q&A
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
A bit of history
Two main categories in current tools:
 Scripting tools
   Ant
   Rake (Ruby based)
   Gradle (Groovy based)
   … many others


   Artifact oriented tools
     Maven
     Debian Package Creation
A bit of history
   Maven 1.x is now almost 12 years old
    project, mostly motionless since 2007 (I cannot
    find anybody still using it or committing to it)
   Maven 2.x was the de facto standard for Java and
    Java EE build
     Most open source projects were switched to
       Maven for their build system
     It’s now seven years old
   Maven 3.x is used in > 90% of Java (EE) startup
    applications.
     It’s now two years old
     Last release – ver. 3.0.3
Agenda
   Automation Build Tool
   A bit of history
   Why Maven?
   An Introduction to Maven
   Drawbacks of Maven
   Best practices
   Maven in software development suite
   Examples
   Q&A
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 and offline
   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
Agenda
 Automation Build Tool
 A bit of history
 Why Maven?
 An Introduction to Maven
 Drawbacks of Maven
 Best practices
 Maven in software development suite
 Examples
 Q&A
An Introduction to Maven
Maven is a tool with multiple facets:

   a BUILD tool

   a DEPENDENCY MANAGEMENT tool

   a DOCUMENTATION tool
An Introduction to Maven
     Project Object Model
     pom.xml




       Maven’s working …

   Generated artifacts (jar, war, ear…),
   Documentation, statistics (test
    results, quality metrics, javadoc, web
    site)…
An Introduction to Maven
   A project can easily be cut into modules
    thanks to Maven
   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
An Introduction to Maven
Project Object Model (POM)
 Basic project information
     groupId, artifactId, version…
     Inheritance, or Aggregation through sub-modules
      (will 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
An Introduction to Maven
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
An Introduction to Maven
An Introduction to Maven
An Introduction to Maven
   When you invoke a phase, Maven will go
    through all the phases until the one
    specified, executing the bound goals:
     mvn package
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?
An Introduction to Maven
Dependencies: A blessing and a curse
 Blessing:
     Transitive dependencies
     easier to find/discover/use java libraries
   Curse:
     Transitive dependencies can rapidly trigger
      a dependency hell!
     Harder to stabilize builds
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

   Nowadays, it’s still very hard to find some jars
    with a decent/coherent versioning, let alone to
    find their sources or javadocs
An Introduction to Maven
   Local repository:
     Local cache for artifacts
     Contain temporary build artifacts
     It’s possible to erase it regularly
     Very useful for offline builds
   By default in user home’s .m2/repository folder
   Can be moved to another place through
    Maven runtime’ settings.xml file
   $MAVEN_HOME/conf/settings.xml
An Introduction to Maven
   Corporate repository/proxy
     Access via file:// and http://
     The first necessary step towards a corporate use of
      maven
   The local and remote repositories are structured
    the same
   Even better: install a repository management tool
     Can proxy external repositories
     Can filter unwanted artifacts
An Introduction to Maven
   Public repositories
     Good for dependencies’ harvesting
     A lot of mis-configured dependencies
     A lot of alpha/beta Maven plugins and
      libraries


   Be cautious when adding public repositories to
    a build process!
       Should be proxied in corporate
An Introduction to Maven
Other key features of Maven:

 POM Inheritance/Aggregation
 Archetypes
 Launching Tests
 … many more…
An Introduction to Maven
   POM – Project Object Model

   Super POM

   Inheritance

   Aggregation

   Inheritance vs Aggregation
An Introduction to Maven
Project Archetypes

   You can build template projects and make them
    available as artifacts in the repositories
       mvn archetype:create-from-project
   Allows to share best practices without neither
    inheritance nor aggregation
     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
An Introduction to Maven
Archetype ArtifactIds         Description
maven-archetype-archetype     An archetype which contains a sample
                              archetype.
maven-archetype-j2ee-simple   An archetype which contains a simplifed sample
                              J2EE application.
maven-archetype-mojo          An archetype which contains a sample a sample
                              Maven plugin.
maven-archetype-plugin        An archetype which contains a sample Maven
                              plugin.
maven-archetype-plugin-site   An archetype which contains a sample Maven
                              plugin site.
maven-archetype-portlet       An archetype which contains a sample JSR-268
                              Portlet.
maven-archetype-quickstart    An archetype which contains a sample Maven
                              project.
maven-archetype-simple        An archetype which contains a simple Maven
                              project.
maven-archetype-site          An archetype which contains a sample Maven
                              site which demonstrates some of the supported
                              document types like APT, XDoc, and FML and
                              demonstrates how to i18n your site.
maven-archetype-site-simple   An archetype which contains a sample Maven
                              site.
maven-archetype-webapp        An archetype which contains a sample Maven
                              Webapp project.
An Introduction to Maven
Launching Tests

   Maven 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…
Agenda
 Automation Build Tool
 A bit of history
 Why Maven?
 An Introduction to Maven
 Drawbacks of Maven
 Best practices
 Maven in software development suite
 Examples
 Q&A
Drawbacks of Maven
   Library repositories are not always safe.

   Maven Conventions

   Hard to find some things about maven and
    plugins

   A huge output log

   Sequential build (Lyfecycle)

   Learning Maven is long in comparison of Ant.
Agenda
   Automation Build Tool
   A bit of history
   Why Maven?
   An Introduction to Maven
   Drawbacks of Maven
   Best practices
   Maven in software development suite
   Examples
   Q&A
Best practices
   Embrace the standardization brought by Maven, don’t
    fight it

   Use POM Inheritance and <dependencyManagement>
    (with import scope), <pluginManagement>

   Use a Repository Manager:
     Sonatype Nexus: http://nexus.sonatype.org
     Jfrog Artifactory: http://artifactory.jfrog.org
     …
Best practices
   Keep your build as simple as possible

   Launch your builds regularly and possibly in a neutral
    zone

   Use the “dependency” and “versions” plugins

   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
     …
Agenda
 Automation Build Tool
 A bit of history
 Why Maven?
 An Introduction to Maven
 Drawbacks of Maven
 Best practices
 Maven in software development suite
 Examples
 Q&A
Maven in a Software development
suite
   Maven is now very well integrated in IDEs
     NetBeans 6.5+ now has very good support for
      Maven
     Eclipse 3.x has very good support also.
     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
 Continuous integration
References and Thanks
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
References and Thanks
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

Thanks
 Many thanks to Pierre-Antoine Grégoire for its
  presentation on YaJUG
 Thanks to Jason van Zyl for its Maven 3 presentation
  http://www.sonatype.com/people/author/jason

More Related Content

What's hot

What's hot (20)

Maven
MavenMaven
Maven
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Continuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarContinuous integration using Jenkins and Sonar
Continuous integration using Jenkins and Sonar
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot Actuator
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Maven
MavenMaven
Maven
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
 
Gradle
GradleGradle
Gradle
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 

Similar to An Introduction to Maven

Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 featuresAngel Ruiz
 
Maven introduction
Maven introductionMaven introduction
Maven introductionLai Hieu
 
Iam New And Noteworthy
Iam New And NoteworthyIam New And Noteworthy
Iam New And NoteworthyAbel Muíño
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoftvenkata20k
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 
Apache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyApache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyVolodymyr Ostapiv
 
How can you improve, harmonize and automate your development process using to...
How can you improve, harmonize and automate your development process using to...How can you improve, harmonize and automate your development process using to...
How can you improve, harmonize and automate your development process using to...John Ferguson Smart Limited
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeHolasz Kati
 
Build Automation using Maven
Build Automation using Maven Build Automation using Maven
Build Automation using Maven Ankit Gubrani
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With SeleniumMarakana Inc.
 
SE2018_Lec-22_-Continuous-Integration-Tools
SE2018_Lec-22_-Continuous-Integration-ToolsSE2018_Lec-22_-Continuous-Integration-Tools
SE2018_Lec-22_-Continuous-Integration-ToolsAmr E. Mohamed
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svnAnkur Goyal
 

Similar to An Introduction to Maven (20)

Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Maven introduction
Maven introductionMaven introduction
Maven introduction
 
Maven
MavenMaven
Maven
 
What is maven
What is mavenWhat is maven
What is maven
 
Iam New And Noteworthy
Iam New And NoteworthyIam New And Noteworthy
Iam New And Noteworthy
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
 
Maven basics
Maven basicsMaven basics
Maven basics
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
Team Maven
Team MavenTeam Maven
Team Maven
 
Apache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyApache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT Academy
 
How can you improve, harmonize and automate your development process using to...
How can you improve, harmonize and automate your development process using to...How can you improve, harmonize and automate your development process using to...
How can you improve, harmonize and automate your development process using to...
 
Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafe
 
Build Automation using Maven
Build Automation using Maven Build Automation using Maven
Build Automation using Maven
 
Maven
MavenMaven
Maven
 
Maven overview
Maven overviewMaven overview
Maven overview
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
SE2018_Lec-22_-Continuous-Integration-Tools
SE2018_Lec-22_-Continuous-Integration-ToolsSE2018_Lec-22_-Continuous-Integration-Tools
SE2018_Lec-22_-Continuous-Integration-Tools
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 

Recently uploaded

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

An Introduction to Maven

  • 1. An Introduction to Apache Author: Vadim Lotar (QC Backend) 2011
  • 2. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 3. Automation Build Tool  Since the early days of modern engineering, automation of build processes has been the key to:  Productivity improvements  Quality insurance  Eliminate dependencies on key personnel  Save time and money  Why would software development be any different?
  • 4. Automation Build Tool  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
  • 5. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 6. 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
  • 7. A bit of history Two main categories in current tools:  Scripting tools  Ant  Rake (Ruby based)  Gradle (Groovy based)  … many others  Artifact oriented tools  Maven  Debian Package Creation
  • 8. A bit of history  Maven 1.x is now almost 12 years old project, mostly motionless since 2007 (I cannot find anybody still using it or committing to it)  Maven 2.x was the de facto standard for Java and Java EE build  Most open source projects were switched to Maven for their build system  It’s now seven years old  Maven 3.x is used in > 90% of Java (EE) startup applications.  It’s now two years old  Last release – ver. 3.0.3
  • 9. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 10. 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 and offline  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
  • 11. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 12. An Introduction to Maven Maven is a tool with multiple facets:  a BUILD tool  a DEPENDENCY MANAGEMENT tool  a DOCUMENTATION tool
  • 13. An Introduction to Maven Project Object Model pom.xml Maven’s working …  Generated artifacts (jar, war, ear…),  Documentation, statistics (test results, quality metrics, javadoc, web site)…
  • 14. An Introduction to Maven  A project can easily be cut into modules thanks to Maven  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
  • 15. An Introduction to Maven Project Object Model (POM)  Basic project information  groupId, artifactId, version…  Inheritance, or Aggregation through sub-modules (will 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
  • 17. 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
  • 20. An Introduction to Maven  When you invoke a phase, Maven will go through all the phases until the one specified, executing the bound goals:  mvn package
  • 21. 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?
  • 22. An Introduction to Maven Dependencies: A blessing and a curse  Blessing:  Transitive dependencies  easier to find/discover/use java libraries  Curse:  Transitive dependencies can rapidly trigger a dependency hell!  Harder to stabilize builds
  • 23. 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  Nowadays, it’s still very hard to find some jars with a decent/coherent versioning, let alone to find their sources or javadocs
  • 24. An Introduction to Maven  Local repository:  Local cache for artifacts  Contain temporary build artifacts  It’s possible to erase it regularly  Very useful for offline builds  By default in user home’s .m2/repository folder  Can be moved to another place through Maven runtime’ settings.xml file  $MAVEN_HOME/conf/settings.xml
  • 25. An Introduction to Maven  Corporate repository/proxy  Access via file:// and http://  The first necessary step towards a corporate use of maven  The local and remote repositories are structured the same  Even better: install a repository management tool  Can proxy external repositories  Can filter unwanted artifacts
  • 26. An Introduction to Maven  Public repositories  Good for dependencies’ harvesting  A lot of mis-configured dependencies  A lot of alpha/beta Maven plugins and libraries  Be cautious when adding public repositories to a build process!  Should be proxied in corporate
  • 27. An Introduction to Maven Other key features of Maven:  POM Inheritance/Aggregation  Archetypes  Launching Tests  … many more…
  • 28. An Introduction to Maven  POM – Project Object Model  Super POM  Inheritance  Aggregation  Inheritance vs Aggregation
  • 29. An Introduction to Maven Project Archetypes  You can build template projects and make them available as artifacts in the repositories  mvn archetype:create-from-project  Allows to share best practices without neither inheritance nor aggregation  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
  • 30. An Introduction to Maven Archetype ArtifactIds Description maven-archetype-archetype An archetype which contains a sample archetype. maven-archetype-j2ee-simple An archetype which contains a simplifed sample J2EE application. maven-archetype-mojo An archetype which contains a sample a sample Maven plugin. maven-archetype-plugin An archetype which contains a sample Maven plugin. maven-archetype-plugin-site An archetype which contains a sample Maven plugin site. maven-archetype-portlet An archetype which contains a sample JSR-268 Portlet. maven-archetype-quickstart An archetype which contains a sample Maven project. maven-archetype-simple An archetype which contains a simple Maven project. maven-archetype-site An archetype which contains a sample Maven site which demonstrates some of the supported document types like APT, XDoc, and FML and demonstrates how to i18n your site. maven-archetype-site-simple An archetype which contains a sample Maven site. maven-archetype-webapp An archetype which contains a sample Maven Webapp project.
  • 31. An Introduction to Maven Launching Tests  Maven 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…
  • 32. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 33. Drawbacks of Maven  Library repositories are not always safe.  Maven Conventions  Hard to find some things about maven and plugins  A huge output log  Sequential build (Lyfecycle)  Learning Maven is long in comparison of Ant.
  • 34. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 35. Best practices  Embrace the standardization brought by Maven, don’t fight it  Use POM Inheritance and <dependencyManagement> (with import scope), <pluginManagement>  Use a Repository Manager:  Sonatype Nexus: http://nexus.sonatype.org  Jfrog Artifactory: http://artifactory.jfrog.org  …
  • 36. Best practices  Keep your build as simple as possible  Launch your builds regularly and possibly in a neutral zone  Use the “dependency” and “versions” plugins  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  …
  • 37. Agenda  Automation Build Tool  A bit of history  Why Maven?  An Introduction to Maven  Drawbacks of Maven  Best practices  Maven in software development suite  Examples  Q&A
  • 38. Maven in a Software development suite  Maven is now very well integrated in IDEs  NetBeans 6.5+ now has very good support for Maven  Eclipse 3.x has very good support also.  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  Continuous integration
  • 39. References and Thanks 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
  • 40. References and Thanks 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 Thanks  Many thanks to Pierre-Antoine Grégoire for its presentation on YaJUG  Thanks to Jason van Zyl for its Maven 3 presentation http://www.sonatype.com/people/author/jason