SlideShare uma empresa Scribd logo
1 de 26
Version Mgmt in
Maven
SOME BEST PRACTICES
Agenda
What is software versioning
How can maven help us?
◦ Maven release plugin

Best practices
◦ What to version?
◦ How to manage versions?

Tips and tricks
◦ Version handling with maven-versions-plugin
◦ Dependency analysis with maven-dependency-plugin
Version identifies software artefacts:

Software Versioning

◦ modules, applications, assemblies, …
◦ Uniquely identifies source code
◦ Build should be repeatable from that version of code

Most used:
◦ Major.minor[.bugfix][-qualifier[-build]]

Qualifiers:
◦
◦
◦
◦
◦

Alpha: not feature complete
Beta: contains critical bugs
CR: release candidate, not fully tested
Final: final version
SNAPSHOT
◦ Floating version, not an actual identification
◦ Should allways be used for code under development
Versioning with Source Code
Management
Basics of SCM (Git, Subversion, CVS, …)
◦ Synching software changes between developers
◦ Allowing multiple branches to be developed simultaneously
◦ Maintenance branches
◦ Feature branches
◦ Merge branches again 

◦ Tagging versions of code
◦ So you can find out later which bugs you solved when

SCM does not put a version number in your artifacts!
Maven in a nutshell
Maven Basics
Convention over configuration
◦ Convention for source code organization
◦ src/main/java
◦ src/webapp
◦ src/test/java

◦ Plugins with default configurations
◦ Jar, war, ear
◦ Surefire tests
◦ Reporting

Dependency Management
◦ Remote repository and local repository
◦ Transactional dependencies
Snapshots
In maven, versions under development have classifier ‘-SNAPSHOT’
◦ When building versions on a development system, you should always build SNAPSHOTS.
◦ When depending on a SNAPSHOT version of another module, maven will give you the latest
(timestamped) version
◦ Could give surprises of code that suddenly stops building
◦ Preferrably have the source code of your SNAPSHOT dependencies built locally

Non SNAPSHOT versions should be built only once and deployed once
◦ Should be tagged in Subversion/Git/CVS, and never changed
◦ (Unless you know for sure nobody got a copy yet)

◦ Released versions should never have SNAPSHOT dependencies
◦ See release plugin later
Organizing Maven Modules
Aggregator POM vs. Parent POM
◦ Aggregator POM organizes build of multiple modules
◦ One per subfolder
◦ Declares which subfolders contain modules

◦ Parent POM centralizes common configuration
◦ Plugin configuration
◦ Dependencies
◦ Dependency Management

Convention: Aggregator POM == Parent POM
◦ Exceptions are allowed
Typical Maven Workspace Hierarchy
Workspace POM
◦ Godfather aka archon (development team)
◦ Application System(s) (set of related applications)
◦ Application or Library

◦ Module Group(s) (if necessary)
◦ Module
Workspace POM
Dummy Aggregator POM
Just to launch other POM’s
Can use symbolic links to point to actual application roots to be built.
Godfather POM
Defines <distributionManagement> and <repositories>
◦ <distributionManagement>: where your artifacts are deployed
◦ <repositories>: where other necessary artifacts can be found

Rarely changes
◦ Simple fixed version number, e.g. 1, 2, 3, …

Do not put shared dependencies here
◦ Use maven import (since maven 2.0.9)
Application System POM
Inherits from Godfather
Defines external dependency versions in <dependencyManagement>
Defines common plugin configuration
◦ E.g. java compiler version

Could build an assembly containing all applications
Application or Library POM
Module groups
Defines internal dependency management
◦ Sibling modules
◦ Can use ${project.version}

Define more shared configuration
◦ Inapplicable on a higher level
◦ E.g. aspect jars to use
Module POM
Defines all direct dependencies
◦ Do not rely on transitive dependencies
◦ Use scopes when applicable
◦
◦
◦
◦

Compile
Runtime (e.g. JDBC Drivers)
Test (e.g. JUnit, DBUnit)
Provided (e.g. Java EE jars)
Maven release plugin
mvn release:prepare release:perform

◦ Verifies if you checked in everything
◦ Verifies if you have SNAPSHOT dependencies
◦ outside the current released modules

◦ Tries to build and test your modules
◦ Updates the version to the release version and tags it in SCM
◦ Recursively

◦ Checks out the tagged version and build and deploys the release version
◦ Updates the version to the next SNAPSHOT version and checks it in
◦ Recursively
Maven release plugin prerequisites
<distributionManagement>
◦ in godfather POM
◦ point to repository server (nexus)

<server> with login for repository
◦ authorized to deploy
◦ in settings.xml

<scm> tag
◦ Point to subversion/git/CVS
Demo1
Command line release cascade

Jenkins demo
What to Version / What to release
Could be: Individual Modules, Applications, Application System?
Depends on the lifecycle of your product
◦ Do you want to deploy/upgrade a single module or application?
◦ Can you test a single module?
◦ Can you test an application without testing the rest of the application system?
◦ Can you trace bugs in one application without knowing what other applications are running?
What if…
you release individual modules
Every module can have its own version
Maintenance releases with individual modules
◦ Dependants can stick to release versions if they want
◦ For big refactorings you need snapshot dependencies

Need big cascaded release to build a new version
What if…
you version an application system
Only one version to manage
Release all at once
Every change need a full release
Mix and match
Release some individual modules
◦ Those that are used in multiple applications

Release some applications as a whole
◦ Applications in maintenance

Release some application systems
◦ With strong intra-application dependencies
More interesting plugins
http://maven.apache.org/plugins/index.html

maven-help-plugin
◦ mvn help:effective-pom

maven-dependency-plugin
◦ mvn dependency:tree
◦ mvn dependency:analyze
◦ mvn dependency:analyze-dep-mgmt

maven-versions-plugin
◦ mvn versions:use-next-snapshots -DexcludeReactor=false -Dincludes=group:*
◦ mvn versions:update-child-modules
Demo2
maven-help-plugin

maven-dependency-plugin

maven-versions-plugin
Questions

Mais conteúdo relacionado

Mais procurados

An Introduction to Rancher
An Introduction to RancherAn Introduction to Rancher
An Introduction to RancherConner Swann
 
Introduction to Nexus Repository Manager.pdf
Introduction to Nexus Repository Manager.pdfIntroduction to Nexus Repository Manager.pdf
Introduction to Nexus Repository Manager.pdfKnoldus Inc.
 
Kubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersKubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersPlatform9
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaWhat is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaEdureka!
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version ControlJeremy Coates
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIDavid Hahn
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Tech Triveni
 
High Availability for OpenStack
High Availability for OpenStackHigh Availability for OpenStack
High Availability for OpenStackKamesh Pemmaraju
 
Docker Networking Overview
Docker Networking OverviewDocker Networking Overview
Docker Networking OverviewSreenivas Makam
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaArvind Kumar G.S
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Araf Karsh Hamid
 
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdService Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdKai Wähner
 
OpenStack networking (Neutron)
OpenStack networking (Neutron) OpenStack networking (Neutron)
OpenStack networking (Neutron) CREATE-NET
 
Build and Manage Multi-Cloud Applications Using Kuma
Build and Manage Multi-Cloud Applications Using KumaBuild and Manage Multi-Cloud Applications Using Kuma
Build and Manage Multi-Cloud Applications Using KumaSven Bernhardt
 
Micro frontend: The microservices puzzle extended to frontend
Micro frontend: The microservices puzzle  extended to frontendMicro frontend: The microservices puzzle  extended to frontend
Micro frontend: The microservices puzzle extended to frontendAudrey Neveu
 
L’hyperconvergence au cœur du Software-defined data center
L’hyperconvergence au cœur du Software-defined data centerL’hyperconvergence au cœur du Software-defined data center
L’hyperconvergence au cœur du Software-defined data centerColloqueRISQ
 

Mais procurados (20)

An Introduction to Rancher
An Introduction to RancherAn Introduction to Rancher
An Introduction to Rancher
 
Introduction to Nexus Repository Manager.pdf
Introduction to Nexus Repository Manager.pdfIntroduction to Nexus Repository Manager.pdf
Introduction to Nexus Repository Manager.pdf
 
Kubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersKubernetes Helm: Why It Matters
Kubernetes Helm: Why It Matters
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaWhat is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
High Availability for OpenStack
High Availability for OpenStackHigh Availability for OpenStack
High Availability for OpenStack
 
Docker Networking Overview
Docker Networking OverviewDocker Networking Overview
Docker Networking Overview
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Ansible
AnsibleAnsible
Ansible
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018
 
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdService Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
 
Vagrant
VagrantVagrant
Vagrant
 
OpenStack networking (Neutron)
OpenStack networking (Neutron) OpenStack networking (Neutron)
OpenStack networking (Neutron)
 
Why to Cloud Native
Why to Cloud NativeWhy to Cloud Native
Why to Cloud Native
 
Build and Manage Multi-Cloud Applications Using Kuma
Build and Manage Multi-Cloud Applications Using KumaBuild and Manage Multi-Cloud Applications Using Kuma
Build and Manage Multi-Cloud Applications Using Kuma
 
Micro frontend: The microservices puzzle extended to frontend
Micro frontend: The microservices puzzle  extended to frontendMicro frontend: The microservices puzzle  extended to frontend
Micro frontend: The microservices puzzle extended to frontend
 
L’hyperconvergence au cœur du Software-defined data center
L’hyperconvergence au cœur du Software-defined data centerL’hyperconvergence au cœur du Software-defined data center
L’hyperconvergence au cœur du Software-defined data center
 

Semelhante a Version Management in Maven

Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld PresentationDan Hinojosa
 
Intro To Version Control
Intro To Version ControlIntro To Version Control
Intro To Version Controlceardach
 
SQL Server DevOps Jumpstart
SQL Server DevOps JumpstartSQL Server DevOps Jumpstart
SQL Server DevOps JumpstartOri Donner
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationArnaud Héritier
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicGourav Varma
 
Presentation 1 open source tools in continuous integration environment v1.0
Presentation 1   open source tools in continuous integration environment v1.0Presentation 1   open source tools in continuous integration environment v1.0
Presentation 1 open source tools in continuous integration environment v1.0Jasmine Conseil
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoftvenkata20k
 
Java is evolving rapidly: Maven helps you staying on track
Java is evolving rapidly:  Maven helps you staying on trackJava is evolving rapidly:  Maven helps you staying on track
Java is evolving rapidly: Maven helps you staying on trackArnaud Héritier
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN ControllerSumit Arora
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversionMangesh Bhujbal
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 featuresAngel Ruiz
 
DevOps presentation
DevOps presentationDevOps presentation
DevOps presentationAxsh Co. LTD
 

Semelhante a Version Management in Maven (20)

Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld Presentation
 
Intro To Version Control
Intro To Version ControlIntro To Version Control
Intro To Version Control
 
Agile Software Development & Tools
Agile Software Development & ToolsAgile Software Development & Tools
Agile Software Development & Tools
 
SQL Server DevOps Jumpstart
SQL Server DevOps JumpstartSQL Server DevOps Jumpstart
SQL Server DevOps Jumpstart
 
Maven
MavenMaven
Maven
 
Build server
Build serverBuild server
Build server
 
A-Z_Maven.pdf
A-Z_Maven.pdfA-Z_Maven.pdf
A-Z_Maven.pdf
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentation
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
 
Presentation 1 open source tools in continuous integration environment v1.0
Presentation 1   open source tools in continuous integration environment v1.0Presentation 1   open source tools in continuous integration environment v1.0
Presentation 1 open source tools in continuous integration environment v1.0
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
 
Java is evolving rapidly: Maven helps you staying on track
Java is evolving rapidly:  Maven helps you staying on trackJava is evolving rapidly:  Maven helps you staying on track
Java is evolving rapidly: Maven helps you staying on track
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversion
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
DevOps presentation
DevOps presentationDevOps presentation
DevOps presentation
 

Mais de Geert Pante

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootGeert Pante
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptxGeert Pante
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECSGeert Pante
 
Docker in practice
Docker in practiceDocker in practice
Docker in practiceGeert Pante
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQGeert Pante
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELKGeert Pante
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring dataGeert Pante
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)Geert Pante
 
Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenGeert Pante
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISGeert Pante
 

Mais de Geert Pante (11)

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring Boot
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptx
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECS
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQ
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELK
 
Java EE 6
Java EE 6Java EE 6
Java EE 6
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring data
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)
 
Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in Maven
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
 

Último

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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
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
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

Último (20)

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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Version Management in Maven

  • 1. Version Mgmt in Maven SOME BEST PRACTICES
  • 2. Agenda What is software versioning How can maven help us? ◦ Maven release plugin Best practices ◦ What to version? ◦ How to manage versions? Tips and tricks ◦ Version handling with maven-versions-plugin ◦ Dependency analysis with maven-dependency-plugin
  • 3. Version identifies software artefacts: Software Versioning ◦ modules, applications, assemblies, … ◦ Uniquely identifies source code ◦ Build should be repeatable from that version of code Most used: ◦ Major.minor[.bugfix][-qualifier[-build]] Qualifiers: ◦ ◦ ◦ ◦ ◦ Alpha: not feature complete Beta: contains critical bugs CR: release candidate, not fully tested Final: final version SNAPSHOT ◦ Floating version, not an actual identification ◦ Should allways be used for code under development
  • 4. Versioning with Source Code Management Basics of SCM (Git, Subversion, CVS, …) ◦ Synching software changes between developers ◦ Allowing multiple branches to be developed simultaneously ◦ Maintenance branches ◦ Feature branches ◦ Merge branches again  ◦ Tagging versions of code ◦ So you can find out later which bugs you solved when SCM does not put a version number in your artifacts!
  • 5.
  • 6. Maven in a nutshell
  • 7. Maven Basics Convention over configuration ◦ Convention for source code organization ◦ src/main/java ◦ src/webapp ◦ src/test/java ◦ Plugins with default configurations ◦ Jar, war, ear ◦ Surefire tests ◦ Reporting Dependency Management ◦ Remote repository and local repository ◦ Transactional dependencies
  • 8. Snapshots In maven, versions under development have classifier ‘-SNAPSHOT’ ◦ When building versions on a development system, you should always build SNAPSHOTS. ◦ When depending on a SNAPSHOT version of another module, maven will give you the latest (timestamped) version ◦ Could give surprises of code that suddenly stops building ◦ Preferrably have the source code of your SNAPSHOT dependencies built locally Non SNAPSHOT versions should be built only once and deployed once ◦ Should be tagged in Subversion/Git/CVS, and never changed ◦ (Unless you know for sure nobody got a copy yet) ◦ Released versions should never have SNAPSHOT dependencies ◦ See release plugin later
  • 9. Organizing Maven Modules Aggregator POM vs. Parent POM ◦ Aggregator POM organizes build of multiple modules ◦ One per subfolder ◦ Declares which subfolders contain modules ◦ Parent POM centralizes common configuration ◦ Plugin configuration ◦ Dependencies ◦ Dependency Management Convention: Aggregator POM == Parent POM ◦ Exceptions are allowed
  • 10. Typical Maven Workspace Hierarchy Workspace POM ◦ Godfather aka archon (development team) ◦ Application System(s) (set of related applications) ◦ Application or Library ◦ Module Group(s) (if necessary) ◦ Module
  • 11. Workspace POM Dummy Aggregator POM Just to launch other POM’s Can use symbolic links to point to actual application roots to be built.
  • 12. Godfather POM Defines <distributionManagement> and <repositories> ◦ <distributionManagement>: where your artifacts are deployed ◦ <repositories>: where other necessary artifacts can be found Rarely changes ◦ Simple fixed version number, e.g. 1, 2, 3, … Do not put shared dependencies here ◦ Use maven import (since maven 2.0.9)
  • 13. Application System POM Inherits from Godfather Defines external dependency versions in <dependencyManagement> Defines common plugin configuration ◦ E.g. java compiler version Could build an assembly containing all applications
  • 14. Application or Library POM Module groups Defines internal dependency management ◦ Sibling modules ◦ Can use ${project.version} Define more shared configuration ◦ Inapplicable on a higher level ◦ E.g. aspect jars to use
  • 15. Module POM Defines all direct dependencies ◦ Do not rely on transitive dependencies ◦ Use scopes when applicable ◦ ◦ ◦ ◦ Compile Runtime (e.g. JDBC Drivers) Test (e.g. JUnit, DBUnit) Provided (e.g. Java EE jars)
  • 16. Maven release plugin mvn release:prepare release:perform ◦ Verifies if you checked in everything ◦ Verifies if you have SNAPSHOT dependencies ◦ outside the current released modules ◦ Tries to build and test your modules ◦ Updates the version to the release version and tags it in SCM ◦ Recursively ◦ Checks out the tagged version and build and deploys the release version ◦ Updates the version to the next SNAPSHOT version and checks it in ◦ Recursively
  • 17. Maven release plugin prerequisites <distributionManagement> ◦ in godfather POM ◦ point to repository server (nexus) <server> with login for repository ◦ authorized to deploy ◦ in settings.xml <scm> tag ◦ Point to subversion/git/CVS
  • 18.
  • 19. Demo1 Command line release cascade Jenkins demo
  • 20. What to Version / What to release Could be: Individual Modules, Applications, Application System? Depends on the lifecycle of your product ◦ Do you want to deploy/upgrade a single module or application? ◦ Can you test a single module? ◦ Can you test an application without testing the rest of the application system? ◦ Can you trace bugs in one application without knowing what other applications are running?
  • 21. What if… you release individual modules Every module can have its own version Maintenance releases with individual modules ◦ Dependants can stick to release versions if they want ◦ For big refactorings you need snapshot dependencies Need big cascaded release to build a new version
  • 22. What if… you version an application system Only one version to manage Release all at once Every change need a full release
  • 23. Mix and match Release some individual modules ◦ Those that are used in multiple applications Release some applications as a whole ◦ Applications in maintenance Release some application systems ◦ With strong intra-application dependencies
  • 24. More interesting plugins http://maven.apache.org/plugins/index.html maven-help-plugin ◦ mvn help:effective-pom maven-dependency-plugin ◦ mvn dependency:tree ◦ mvn dependency:analyze ◦ mvn dependency:analyze-dep-mgmt maven-versions-plugin ◦ mvn versions:use-next-snapshots -DexcludeReactor=false -Dincludes=group:* ◦ mvn versions:update-child-modules