SlideShare a Scribd company logo
Maven Nutshell
   The Main Concepts



     Valerio Capozio   1 of 14
Apache Maven
  Maven is a build automation tool, developed and managed from Apache Software
Foundation.
  Maven serves a similar purpose of Apache Ant tool, but it offers an unparalleled software
lifecycle management, providing a cohesive suite of verification, compilation, testing, packaging,
reporting, and deployment plugins.
  Maven uses a convention over configuration approach to builds.
  Maven is typically used in Java projects, but it can be used also to manage projects in C#,
Scala, Ruby and more other languages.




                                         Valerio Capozio                             2 of 14
Project Object Model
  Maven revolves around a metadata file, named
pom.xml
  A file with this name has to exist in the root of
every Maven project.
  In this file are defined the plugins to use, paths           The snippet above shows the minimum information
                                                               needed to define uniquely a Maven project through a
and settings to override the Maven defaults of                 Pom.

your project.                                                  A Maven project produces an element, such as JAR, WAR,
                                                               EAR, etc uniquely identified by a vector of fields (groupId,
  Each POM inherits automatically from a Super                 artifactId, packaging, version).

POM, a virtual POM embedded in the Maven core.                 A syntax to refer a specific Maven artifact is a string of
                                                               vector elements, colon separated:
  Maven supports natively multi-module projects.                     groupId:artifactId:packaging:version


                http://maven.apache.org/guides/introduction/introduction-to-the-pom.html




                                             Valerio Capozio                                              3 of 14
Execution Hierarchy
  Maven splits execution into four nested hierarchies.
From most-generic to most-specific they are:
         Lifecycle
         Phase
         Plugin
         Goal
  Lifecycle represents a well-recognized flow of steps.
  Phase is a step of lifecycle. Zero or more plugin goals
are bound to a phase.
  Plugin is a logical grouping and distribution of related
goals.
  Goal is a single executable task within a plugin.




                                            Valerio Capozio   4 of 14
Built-in Maven Lifecycle
  Maven has three built-in lifecycles:
         Clean
         Default
         Site
  Many of the phases within these three lifecycles are bound to a sensible plugin goal.
  Clean lifecycle deletes all generated artifacts from the output directory.
  Default lifecycle defines the commonly used phases to build an artifact, from its compilation
to its installation on remote repository.
  Site lifecycle generates a project information web site and is able to deploy the artifacts to a
specified web server or local path.


              http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html




                                            Valerio Capozio                                5 of 14
Phases of Clean and Site Lifecycles

             Clean Lifecycle                                         Site Lifecycle
  Phase               Purpose                             Phase               Purpose
pre-clean     -                                        pre-site       Cross check that all
                                                                      elements necessary for
clean         Remove all generated and
                                                                      the build are correct and
              compiled artifacts in
                                                                      present.
              preperation for a fresh
              build.                                   site           Generate an HTML web
                                                                      site containing project
post-clean    -
                                                                      information and reports.
                                                       post-site      -
                                                       site-deploy    Upload the generated
                                                                      website to a web server.




                                     Valerio Capozio                                  6 of 14
Phases of Default Lifecycle 1/2
                                                 Default Lifecycle
        Phase                                                        Purpose
validate                  validate the project is correct and all necessary information is available.
initialize                initialize build state, e.g. set properties or create directories.
generate-sources          generate any source code for inclusion in compilation.
process-sources           process the source code, for example to filter any values.
generate-resources        generate resources for inclusion in the package.
process-resources         copy and process the resources into the destination directory, ready for packaging.
compile                   compile the source code of the project.
process-classes           post-process the generated files from compilation (e.g. to do bytecode enhancement on classes)
generate-test-sources     generate any test source code for inclusion in compilation.
process-test-sources      process the test source code, for example to filter any values.
generate-test-resources   create resources for testing.
process-test-resources    copy and process the resources into the test destination directory.
test-compile              compile the test source code into the test destination directory
process-test-classes      post-process the generated files from test compilation (e.g. to do bytecode enhancement on
                          classes)




                                                   Valerio Capozio                                          7 of 14
Phases of Default Lifecycle 2/2
                                                Default Lifecycle
          Phase                                                     Purpose
test                    run tests using a suitable unit testing framework. These tests should not require the code be
                        packaged or deployed.
prepare-package         perform any operations necessary to prepare a package before the actual packaging. This often
                        results in an unpacked, processed version of the package. (Maven 2.1 and above)
package                 take the compiled code and package it in its distributable format, such as a JAR.
pre-integration-test    perform actions required before integration tests are executed. This may involve things such as
                        setting up the required environment.
integration-test        process and deploy the package if necessary into an environment where integration tests can be
                        run.
post-integration-test   perform actions required after integration tests have been executed. This may including cleaning up
                        the environment.
verify                  run any checks to verify the package is valid and meets quality criteria.
install                 install the package into the local repository, for use as a dependency in other projects locally.
deploy                  done in an integration or release environment, copies the final package to the remote repository for
                        sharing with other developers and projects.




                                                  Valerio Capozio                                           8 of 14
Dependency
                                                                            To express the reliance of our project on
                                                                          a particular artifact is possible declare a
                                                                          dependency in the Pom file.
                                                                            Each dependency can specify a scope,
                                                                          which manages its visibility and inclusion
Scope        Description                                                  in the final artifact.
compile      Needed for compilation, included in packages.
                                                                            Maven      manages     automatically   the
test         Needed for unit tests, not included in packages.
                                                                          transitive dependencies.
provided     Needed for compilation, but provided ar
             runtime.
                                                                            Dependency scope can affect the
system       Needed for compilation, given as absolute path
             on disk and not included in packages.                        transitivity mechanism.
import       Inline inclusion of a POM-type artifact.

           http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html



                                                        Valerio Capozio                                   9 of 14
Plugins
                                                             A plugin and its configuration are added
                                                           with a declaration, very similar to a
                                                           dependency, in the build section of the
                                                           Pom file.
                                                             Mojo is the acronym of the Maven
                                                           plugin      classes   and   derives   from
             Common Plugins                                aggregation of “Plain Old Java Object” and
surefire      Runs unit tests                              “Maven Java Object”.
checkstile    Check the code’s styling
assembly      Create ZIP and other
              distribution packages.




                                         Valerio Capozio                                  10 of 14
Repository
                                                              Repositories are used to hold collections
                                                            of Maven artifacts and dependencies.
                                                              Exist only two type of repositories: local
                                                            and remote.
                                                              Local repository refers to a copy on your
                                                            own installation. This repository is a cache
           Popular Repositories                             copy of the remote downloads.
Maven       http://repo1.maven.org/maven2/
                                                              Remote repositories are any other type
Codehaus    http://repository.codehaus.org/
                                                            of repository accessed by some protocol
JBoss       http://repository.jboss.org/maven2
                                                            (e.g. http:// file:// etc.)




                                          Valerio Capozio                                  11 of 14
Profiles
  With      profiles    can   specify     particular
behaviors       on      portions     of     Maven
configuration, including plugins, pathing and
configuration.
  They modify the POM at build time, and
are meant to be used in complementary sets
to give equivalent-but-different parameters
                                                                   The snippet above shows an example of profile
for a set of target environments.                                  declaration.
                                                                   A profile can be triggered/activated in several ways:
  A typical use of profiles is for build-time                         Explicitly
                                                                      Through Maven settings
customization of JAR dependencies based on                            Based on environment variables
                                                                      OS settings
the use of a specific Application Server.                             Present or missing files
                     http://maven.apache.org/guides/introduction/introduction-to-profiles.html



                                                 Valerio Capozio                                         12 of 14
About me
   Valerio Capozio                     Website
                                       angelusworld.com

                                       Linkedin
                                       linkendin.com

                                       Slideshare
                                       slideshare.net

                                       Twitter
                                       twitter.com




                     Valerio Capozio                      13 of 14
Thanks
Valerio Capozio   14 of 14

More Related Content

What's hot

Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVMRomain Schlick
 
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢apkiban
 
Quarkus Denmark 2019
Quarkus Denmark 2019Quarkus Denmark 2019
Quarkus Denmark 2019Max Andersen
 
Quarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesQuarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesRed Hat Developers
 
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)NTT DATA Technology & Innovation
 
Jenkins, pipeline and docker
Jenkins, pipeline and docker Jenkins, pipeline and docker
Jenkins, pipeline and docker AgileDenver
 
Oracle jdk 20190827 - 今、あらためてOracle提供のJDKを語る
Oracle jdk 20190827 - 今、あらためてOracle提供のJDKを語るOracle jdk 20190827 - 今、あらためてOracle提供のJDKを語る
Oracle jdk 20190827 - 今、あらためてOracle提供のJDKを語るオラクルエンジニア通信
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineVMware Tanzu
 
Why Docker
Why DockerWhy Docker
Why DockerdotCloud
 
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)NTT DATA Technology & Innovation
 
BuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドBuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドAkihiro Suda
 
Presentación Spring Boot en Autentia
Presentación Spring Boot en AutentiaPresentación Spring Boot en Autentia
Presentación Spring Boot en AutentiaJorge Pacheco Mengual
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootKashif Ali Siddiqui
 
NoSQL on AWSで作る最新ソーシャルゲームアーキテクチャ
NoSQL on AWSで作る最新ソーシャルゲームアーキテクチャNoSQL on AWSで作る最新ソーシャルゲームアーキテクチャ
NoSQL on AWSで作る最新ソーシャルゲームアーキテクチャYasuhiro Matsuo
 

What's hot (20)

Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVM
 
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
 
Quarkus Denmark 2019
Quarkus Denmark 2019Quarkus Denmark 2019
Quarkus Denmark 2019
 
Quarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesQuarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniques
 
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
Java 17直前!オレ流OpenJDK「の」開発環境(Open Source Conference 2021 Online/Kyoto 発表資料)
 
Jenkins, pipeline and docker
Jenkins, pipeline and docker Jenkins, pipeline and docker
Jenkins, pipeline and docker
 
Exception handling
Exception handling Exception handling
Exception handling
 
Oracle jdk 20190827 - 今、あらためてOracle提供のJDKを語る
Oracle jdk 20190827 - 今、あらためてOracle提供のJDKを語るOracle jdk 20190827 - 今、あらためてOracle提供のJDKを語る
Oracle jdk 20190827 - 今、あらためてOracle提供のJDKを語る
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring Statemachine
 
Why Docker
Why DockerWhy Docker
Why Docker
 
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
より速く より運用しやすく 進化し続けるJVM(Java Developers Summit Online 2023 発表資料)
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
BuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドBuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルド
 
Oop java
Oop javaOop java
Oop java
 
Presentación Spring Boot en Autentia
Presentación Spring Boot en AutentiaPresentación Spring Boot en Autentia
Presentación Spring Boot en Autentia
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring Boot
 
NoSQL on AWSで作る最新ソーシャルゲームアーキテクチャ
NoSQL on AWSで作る最新ソーシャルゲームアーキテクチャNoSQL on AWSで作る最新ソーシャルゲームアーキテクチャ
NoSQL on AWSで作る最新ソーシャルゲームアーキテクチャ
 

Similar to Maven nutshell

Similar to Maven nutshell (20)

Apache maven, a software project management tool
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management tool
 
Maven
MavenMaven
Maven
 
Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
 
Maven
MavenMaven
Maven
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
 
P&MSP2012 - Maven
P&MSP2012 - MavenP&MSP2012 - Maven
P&MSP2012 - Maven
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Maven
MavenMaven
Maven
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Maven
MavenMaven
Maven
 
Maven basics
Maven basicsMaven basics
Maven basics
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptxCoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
 
Introduction to maven
Introduction to mavenIntroduction to maven
Introduction to maven
 
Maven
MavenMaven
Maven
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Maven
MavenMaven
Maven
 

Recently uploaded

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationZilliz
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...Product School
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 

Recently uploaded (20)

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

Maven nutshell

  • 1. Maven Nutshell The Main Concepts Valerio Capozio 1 of 14
  • 2. Apache Maven Maven is a build automation tool, developed and managed from Apache Software Foundation. Maven serves a similar purpose of Apache Ant tool, but it offers an unparalleled software lifecycle management, providing a cohesive suite of verification, compilation, testing, packaging, reporting, and deployment plugins. Maven uses a convention over configuration approach to builds. Maven is typically used in Java projects, but it can be used also to manage projects in C#, Scala, Ruby and more other languages. Valerio Capozio 2 of 14
  • 3. Project Object Model Maven revolves around a metadata file, named pom.xml A file with this name has to exist in the root of every Maven project. In this file are defined the plugins to use, paths The snippet above shows the minimum information needed to define uniquely a Maven project through a and settings to override the Maven defaults of Pom. your project. A Maven project produces an element, such as JAR, WAR, EAR, etc uniquely identified by a vector of fields (groupId, Each POM inherits automatically from a Super artifactId, packaging, version). POM, a virtual POM embedded in the Maven core. A syntax to refer a specific Maven artifact is a string of vector elements, colon separated: Maven supports natively multi-module projects. groupId:artifactId:packaging:version http://maven.apache.org/guides/introduction/introduction-to-the-pom.html Valerio Capozio 3 of 14
  • 4. Execution Hierarchy Maven splits execution into four nested hierarchies. From most-generic to most-specific they are: Lifecycle Phase Plugin Goal Lifecycle represents a well-recognized flow of steps. Phase is a step of lifecycle. Zero or more plugin goals are bound to a phase. Plugin is a logical grouping and distribution of related goals. Goal is a single executable task within a plugin. Valerio Capozio 4 of 14
  • 5. Built-in Maven Lifecycle Maven has three built-in lifecycles: Clean Default Site Many of the phases within these three lifecycles are bound to a sensible plugin goal. Clean lifecycle deletes all generated artifacts from the output directory. Default lifecycle defines the commonly used phases to build an artifact, from its compilation to its installation on remote repository. Site lifecycle generates a project information web site and is able to deploy the artifacts to a specified web server or local path. http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html Valerio Capozio 5 of 14
  • 6. Phases of Clean and Site Lifecycles Clean Lifecycle Site Lifecycle Phase Purpose Phase Purpose pre-clean - pre-site Cross check that all elements necessary for clean Remove all generated and the build are correct and compiled artifacts in present. preperation for a fresh build. site Generate an HTML web site containing project post-clean - information and reports. post-site - site-deploy Upload the generated website to a web server. Valerio Capozio 6 of 14
  • 7. Phases of Default Lifecycle 1/2 Default Lifecycle Phase Purpose validate validate the project is correct and all necessary information is available. initialize initialize build state, e.g. set properties or create directories. generate-sources generate any source code for inclusion in compilation. process-sources process the source code, for example to filter any values. generate-resources generate resources for inclusion in the package. process-resources copy and process the resources into the destination directory, ready for packaging. compile compile the source code of the project. process-classes post-process the generated files from compilation (e.g. to do bytecode enhancement on classes) generate-test-sources generate any test source code for inclusion in compilation. process-test-sources process the test source code, for example to filter any values. generate-test-resources create resources for testing. process-test-resources copy and process the resources into the test destination directory. test-compile compile the test source code into the test destination directory process-test-classes post-process the generated files from test compilation (e.g. to do bytecode enhancement on classes) Valerio Capozio 7 of 14
  • 8. Phases of Default Lifecycle 2/2 Default Lifecycle Phase Purpose test run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed. prepare-package perform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package. (Maven 2.1 and above) package take the compiled code and package it in its distributable format, such as a JAR. pre-integration-test perform actions required before integration tests are executed. This may involve things such as setting up the required environment. integration-test process and deploy the package if necessary into an environment where integration tests can be run. post-integration-test perform actions required after integration tests have been executed. This may including cleaning up the environment. verify run any checks to verify the package is valid and meets quality criteria. install install the package into the local repository, for use as a dependency in other projects locally. deploy done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects. Valerio Capozio 8 of 14
  • 9. Dependency To express the reliance of our project on a particular artifact is possible declare a dependency in the Pom file. Each dependency can specify a scope, which manages its visibility and inclusion Scope Description in the final artifact. compile Needed for compilation, included in packages. Maven manages automatically the test Needed for unit tests, not included in packages. transitive dependencies. provided Needed for compilation, but provided ar runtime. Dependency scope can affect the system Needed for compilation, given as absolute path on disk and not included in packages. transitivity mechanism. import Inline inclusion of a POM-type artifact. http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html Valerio Capozio 9 of 14
  • 10. Plugins A plugin and its configuration are added with a declaration, very similar to a dependency, in the build section of the Pom file. Mojo is the acronym of the Maven plugin classes and derives from Common Plugins aggregation of “Plain Old Java Object” and surefire Runs unit tests “Maven Java Object”. checkstile Check the code’s styling assembly Create ZIP and other distribution packages. Valerio Capozio 10 of 14
  • 11. Repository Repositories are used to hold collections of Maven artifacts and dependencies. Exist only two type of repositories: local and remote. Local repository refers to a copy on your own installation. This repository is a cache Popular Repositories copy of the remote downloads. Maven http://repo1.maven.org/maven2/ Remote repositories are any other type Codehaus http://repository.codehaus.org/ of repository accessed by some protocol JBoss http://repository.jboss.org/maven2 (e.g. http:// file:// etc.) Valerio Capozio 11 of 14
  • 12. Profiles With profiles can specify particular behaviors on portions of Maven configuration, including plugins, pathing and configuration. They modify the POM at build time, and are meant to be used in complementary sets to give equivalent-but-different parameters The snippet above shows an example of profile for a set of target environments. declaration. A profile can be triggered/activated in several ways: A typical use of profiles is for build-time Explicitly Through Maven settings customization of JAR dependencies based on Based on environment variables OS settings the use of a specific Application Server. Present or missing files http://maven.apache.org/guides/introduction/introduction-to-profiles.html Valerio Capozio 12 of 14
  • 13. About me Valerio Capozio Website angelusworld.com Linkedin linkendin.com Slideshare slideshare.net Twitter twitter.com Valerio Capozio 13 of 14