SlideShare a Scribd company logo

Continuous delivery-with-maven

Maven is close to ubiquitous in the world of enterprise Java, and the Maven dependency ecosystem is the de facto industry standard. However, the traditional Maven build and release strategy, based on snapshot versions and carefully planned releases, is difficult to reconcile with modern continuous delivery practices, where any commit that passes a series of quality-control gateways can qualify as a release. How can teams using the standard Maven release process still leverage the benefits of continuous delivery? This presentation discusses strategies that can be used to implement continuous delivery solutions with Maven and demonstrates one such strategy using Maven, Jenkins, and Git.

1 of 96
Download to read offline
Real-World Strategies for Continuous Delivery
          with Maven and Jenkins




                          John Ferguson Smart
Consulta
                    nt
            Trainer
           Mentor
           Author
          Speaker
          Coder
John Fer
         guson S
                 mar t
Continuous Delivery

 Getting value to the business.
             Fast.




                       3
But what is Continuous Delivery?
     A build tool?

                     A CI tool?

                      Automated tests?



       Automated quality?

            Automated deployment?
Yes...and No
Continuous Delivery is an attitude

Recommended

An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 
Advanced WebLogic Monitoring: JMX and WLSDM Automation
Advanced WebLogic Monitoring: JMX and WLSDM AutomationAdvanced WebLogic Monitoring: JMX and WLSDM Automation
Advanced WebLogic Monitoring: JMX and WLSDM AutomationM. Fevzi Korkutata
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...Edureka!
 
Build Automation using Maven
Build Automation using Maven Build Automation using Maven
Build Automation using Maven Ankit Gubrani
 

More Related Content

What's hot (20)

(ARC307) Infrastructure as Code
(ARC307) Infrastructure as Code(ARC307) Infrastructure as Code
(ARC307) Infrastructure as Code
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins Introduction
 
DevOps and Build Automation
DevOps and Build AutomationDevOps and Build Automation
DevOps and Build Automation
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
devops
devops devops
devops
 
DevOps - A Gentle Introduction
DevOps - A Gentle IntroductionDevOps - A Gentle Introduction
DevOps - A Gentle Introduction
 
DevOps Introduction
DevOps IntroductionDevOps Introduction
DevOps Introduction
 
Maven ppt
Maven pptMaven ppt
Maven ppt
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
DevOps Best Practices
DevOps Best PracticesDevOps Best Practices
DevOps Best Practices
 
CONTINUOUS INTEGRATION WITH JENKINS AND GIT
CONTINUOUS INTEGRATION WITH JENKINS AND GITCONTINUOUS INTEGRATION WITH JENKINS AND GIT
CONTINUOUS INTEGRATION WITH JENKINS AND GIT
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
Custom policies in mule 4 and a circuit breaker example
Custom policies in mule 4 and a circuit breaker exampleCustom policies in mule 4 and a circuit breaker example
Custom policies in mule 4 and a circuit breaker example
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
Docker
DockerDocker
Docker
 

Viewers also liked

Soasta | CloudBees webinar 11/12/2015
Soasta | CloudBees webinar 11/12/2015Soasta | CloudBees webinar 11/12/2015
Soasta | CloudBees webinar 11/12/2015SOASTA
 
Camunda BPM 7.2: CMMN Case Management (English)
Camunda BPM 7.2: CMMN Case Management (English)Camunda BPM 7.2: CMMN Case Management (English)
Camunda BPM 7.2: CMMN Case Management (English)camunda services GmbH
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in MavenGeert Pante
 
DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney DevSecCon
 
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"Daniel Bryant
 
Jenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryJenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryVirendra Bhalothia
 

Viewers also liked (7)

Soasta | CloudBees webinar 11/12/2015
Soasta | CloudBees webinar 11/12/2015Soasta | CloudBees webinar 11/12/2015
Soasta | CloudBees webinar 11/12/2015
 
Camunda BPM 7.2: CMMN Case Management (English)
Camunda BPM 7.2: CMMN Case Management (English)Camunda BPM 7.2: CMMN Case Management (English)
Camunda BPM 7.2: CMMN Case Management (English)
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in Maven
 
DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney DevSecCon London 2017: Shift happens ... by Colin Domoney
DevSecCon London 2017: Shift happens ... by Colin Domoney
 
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
 
Continuous Delivery e-book
Continuous Delivery e-bookContinuous Delivery e-book
Continuous Delivery e-book
 
Jenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous DeliveryJenkins - From Continuous Integration to Continuous Delivery
Jenkins - From Continuous Integration to Continuous Delivery
 

Similar to Continuous delivery-with-maven

Linuxtag 2012 - continuous delivery - dream to reality
Linuxtag 2012  - continuous delivery - dream to realityLinuxtag 2012  - continuous delivery - dream to reality
Linuxtag 2012 - continuous delivery - dream to realityClément Escoffier
 
Sistemas operacionais 12
Sistemas operacionais 12Sistemas operacionais 12
Sistemas operacionais 12Nauber Gois
 
Continuous deployment
Continuous deploymentContinuous deployment
Continuous deploymentDaniel
 
Continuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenContinuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenAlan Parkinson
 
Continuous Delivery in the real world - techniques to reduce the developers b...
Continuous Delivery in the real world - techniques to reduce the developers b...Continuous Delivery in the real world - techniques to reduce the developers b...
Continuous Delivery in the real world - techniques to reduce the developers b...Nikolai Blackie
 
Jdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsJdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsMert Çalışkan
 
Continuous delivery @åf consult
Continuous delivery @åf consultContinuous delivery @åf consult
Continuous delivery @åf consultTomas Riha
 
Integration Testing on Steroids: Run Your Tests on the Real Things
Integration Testing on Steroids: Run Your Tests on the Real ThingsIntegration Testing on Steroids: Run Your Tests on the Real Things
Integration Testing on Steroids: Run Your Tests on the Real ThingsAtlassian
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsJohn Ferguson Smart Limited
 
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 worldDmitry Bakaleinik
 
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 toolRenato Primavera
 
Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...
Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...
Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...manssandstrom
 
maven
mavenmaven
mavenakd11
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by ExampleHsi-Kai Wang
 

Similar to Continuous delivery-with-maven (20)

Linuxtag 2012 - continuous delivery - dream to reality
Linuxtag 2012  - continuous delivery - dream to realityLinuxtag 2012  - continuous delivery - dream to reality
Linuxtag 2012 - continuous delivery - dream to reality
 
Sistemas operacionais 12
Sistemas operacionais 12Sistemas operacionais 12
Sistemas operacionais 12
 
Continuous deployment
Continuous deploymentContinuous deployment
Continuous deployment
 
Continuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenContinuous Deployment Pipeline with maven
Continuous Deployment Pipeline with maven
 
Continuous Delivery in the real world - techniques to reduce the developers b...
Continuous Delivery in the real world - techniques to reduce the developers b...Continuous Delivery in the real world - techniques to reduce the developers b...
Continuous Delivery in the real world - techniques to reduce the developers b...
 
Jdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsJdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent Projects
 
Continuous delivery @åf consult
Continuous delivery @åf consultContinuous delivery @åf consult
Continuous delivery @åf consult
 
Integration Testing on Steroids: Run Your Tests on the Real Things
Integration Testing on Steroids: Run Your Tests on the Real ThingsIntegration Testing on Steroids: Run Your Tests on the Real Things
Integration Testing on Steroids: Run Your Tests on the Real Things
 
Maven
MavenMaven
Maven
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yards
 
Apache_Maven
Apache_MavenApache_Maven
Apache_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
 
P&MSP2012 - Maven
P&MSP2012 - MavenP&MSP2012 - Maven
P&MSP2012 - Maven
 
Maven
MavenMaven
Maven
 
Project Apash
Project ApashProject Apash
Project Apash
 
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
 
Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...
Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...
Att lyckas med integration av arbetet från flera scrum team - Christophe Acho...
 
maven
mavenmaven
maven
 
Maven2交流
Maven2交流Maven2交流
Maven2交流
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 

More from John Ferguson Smart Limited

My Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin ScenariosMy Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin ScenariosJohn Ferguson Smart Limited
 
Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...John Ferguson Smart Limited
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceJohn Ferguson Smart Limited
 
Sustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and ScreenplaySustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and ScreenplayJohn Ferguson Smart Limited
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceJohn Ferguson Smart Limited
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...John Ferguson Smart Limited
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...John Ferguson Smart Limited
 
Screenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testingScreenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testingJohn Ferguson Smart Limited
 
All the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practicesAll the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practicesJohn Ferguson Smart Limited
 
It's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for TestersIt's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for TestersJohn Ferguson Smart Limited
 

More from John Ferguson Smart Limited (20)

My Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin ScenariosMy Reading Specs - Refactoring Patterns for Gherkin Scenarios
My Reading Specs - Refactoring Patterns for Gherkin Scenarios
 
Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...Artisti e Condotierri - How can your team become artists of the 21st century ...
Artisti e Condotierri - How can your team become artists of the 21st century ...
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a difference
 
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANTBE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
 
Sustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and ScreenplaySustainable Test Automation with Serenity BDD and Screenplay
Sustainable Test Automation with Serenity BDD and Screenplay
 
Feature Mapping Workshop
Feature Mapping WorkshopFeature Mapping Workshop
Feature Mapping Workshop
 
Engage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a differenceEngage! Bringing teams together to deliver software that makes a difference
Engage! Bringing teams together to deliver software that makes a difference
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
 
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
 
Shift left-devoxx-pl
Shift left-devoxx-plShift left-devoxx-pl
Shift left-devoxx-pl
 
Screenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testingScreenplay - Next generation automated acceptance testing
Screenplay - Next generation automated acceptance testing
 
Cucumber and Spock Primer
Cucumber and Spock PrimerCucumber and Spock Primer
Cucumber and Spock Primer
 
All the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practicesAll the world's a stage – the next step in automated testing practices
All the world's a stage – the next step in automated testing practices
 
CukeUp 2016 Agile Product Planning Workshop
CukeUp 2016 Agile Product Planning WorkshopCukeUp 2016 Agile Product Planning Workshop
CukeUp 2016 Agile Product Planning Workshop
 
BDD Anti-patterns
BDD Anti-patternsBDD Anti-patterns
BDD Anti-patterns
 
Serenity and the Journey Pattern
Serenity and the Journey PatternSerenity and the Journey Pattern
Serenity and the Journey Pattern
 
BDD - Collaborate like you mean it!
BDD - Collaborate like you mean it!BDD - Collaborate like you mean it!
BDD - Collaborate like you mean it!
 
BDD-Driven Microservices
BDD-Driven MicroservicesBDD-Driven Microservices
BDD-Driven Microservices
 
BDD Anti-patterns
BDD Anti-patternsBDD Anti-patterns
BDD Anti-patterns
 
It's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for TestersIt's Testing, Jim, but not as we know it - BDD for Testers
It's Testing, Jim, but not as we know it - BDD for Testers
 

Continuous delivery-with-maven

  • 1. Real-World Strategies for Continuous Delivery with Maven and Jenkins John Ferguson Smart
  • 2. Consulta nt Trainer Mentor Author Speaker Coder John Fer guson S mar t
  • 3. Continuous Delivery Getting value to the business. Fast. 3
  • 4. But what is Continuous Delivery? A build tool? A CI tool? Automated tests? Automated quality? Automated deployment?
  • 7. Deliver business value more frequently
  • 8. Value can also come in the form of fast feedback
  • 9. Give power back to the business
  • 12. Principle #1 Every build is a potential release
  • 15. Principle #4 Have automated tests you can trust
  • 16. Build Pipelines The conveyer belts of Continuous Delivery
  • 17. Compile and unit test Package and deploy DEV Acceptance tests Deploy to QA QA Deploy to PROD PROD
  • 18. Compile and unit test Each commit is a potential release Package and deploy DEV Acceptance tests Deploy to QA QA Deploy to PROD PROD
  • 19. Compile and unit test Package and deploy DEV Acceptance tests We reuse the same binaries Deploy to QA QA Deploy to PROD PROD
  • 20. Compile and unit test Package and deploy DEV Acceptance tests Automated tests give us confidence in our build Deploy to QA QA Deploy to PROD PROD
  • 21. Compile and unit test Package and deploy DEV Acceptance tests Automated, repeatable deployments QA Deploy to QA Deploy to PROD PROD
  • 22. Continuous Delivery with Maven Why does it have to be so hard?!
  • 23. The Maven lifecycle compile test-compile test package integration-test verify install deploy
  • 24. The Maven lifecycle Compile and unit test mvn test compile test-compile test Integration tests mvn verify compile test-compile test package integration-test verify
  • 25. The Maven lifecycle Compile and unit test mvn test compile test-compile test compile test-compile Integration tests mvn verify test package integration-test verify Deploy to repository compile mvn deploy test-compile test package integration-test verify deploy
  • 26. The Maven Release Process 1.0.0-SNAPSHOT 1.0.0-SNAPSHOT mvn release 1.0.0
  • 27. The Maven Release Process mvn release:prepare • Check that there are no uncommitted changes in the sources • Check that there are no SNAPSHOT dependencies • Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use) • Transform the SCM information in the POM to include the final destination of the tag • Run the project tests against the modified POMs to confirm everything is in working order • Commit the modified POMs • Tag the code in the SCM with a version name (this will be prompted for) • Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for) • Commit the modified POMs
  • 28. The Maven Release Process mvn release:prepare compile test-compile test package 1.0.0 integration-test verify 1.0.1-SNAPSHOT 1.0.0-SNAPSHOT 1.0.1-SNAPSHOT
  • 29. The Maven Release Process mvn release:perform compile test-compile test 1.0.0 package integration-test verify install deploy 1.0.0
  • 30. The Maven Release Process Maven: You build a new release when a snapshot build is good enough Continuous Delivery: Any build is a potential release
  • 32. Beware duplication! Build and unit test mvn test Integration tests mvn verify Code coverage... mvn site
  • 33. Minimize build jobs for the main build Default build mvn install compile test integration-test verify install
  • 34. Split unit and integration tests            <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-surefire-plugin</artifactId>                 <version>2.11</version>                 <configuration>                     <skip>true</skip>                 </configuration>                 <executions>                     <execution>                         <id>unit-tests</id>                         <phase>test</phase>                         <goals>                             <goal>test</goal>                         </goals>                         <configuration>                             <skip>false</skip>                             <includes>                                 <include>**/When*.*</include>                             </includes>                             <excludes>                                 <exclude>%regex[.*integration.*When.*]</exclude>                             </excludes>                         </configuration>                     </execution>                     <execution>                         <id>integration-tests</id>                         <phase>integration-test</phase>                         <goals>                             <goal>test</goal>                         </goals>                         <configuration>                             <skip>false</skip>                             <includes>                                 <include>%regex[.*integration.*]</include>                             </includes>                         </configuration>                     </execution> Using package conventions                 </executions>             </plugin>
  • 35. Split unit and integration tests                 <groupId>org.apache.maven.plugins</groupId>            <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-surefire-plugin</artifactId>                 <artifactId>maven-surefire-plugin</artifactId>                 <version>2.11</version>                 <version>2.11</version>                 <configuration>                 <configuration>                     <skip>true</skip>                     <skip>true</skip>                 </configuration>                 </configuration>                 <executions>                     <execution>                         <id>unit-tests</id>                         <phase>test</phase>                         <goals>                             <goal>test</goal>                         </goals>                         <configuration>                             <skip>false</skip>                             <includes>                                 <include>**/When*.*</include>                             </includes>                             <excludes>                                 <exclude>%regex[.*integration.*When.*]</exclude>                             </excludes>                         </configuration>                     </execution>                     <execution>                         <id>integration-tests</id>                         <phase>integration-test</phase>                         <goals>                             <goal>test</goal>                         </goals>                         <configuration>                             <skip>false</skip>                             <includes>                                 <include>%regex[.*integration.*]</include>                             </includes>                         </configuration>                     </execution> Using package conventions                 </executions>             </plugin>
  • 36. Split unit and integration tests            <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-surefire-plugin</artifactId>                     <execution>                 <version>2.11</version>                 <configuration>                         <id>unit-tests</id>                     <skip>true</skip>                         <phase>test</phase>                 </configuration>                         <goals>                 <executions>                     <execution>                             <goal>test</goal>                         <id>unit-tests</id>                         </goals>                         <phase>test</phase>                         <goals>                         <configuration>                             <goal>test</goal>                             <skip>false</skip>                         </goals>                             <includes>                         <configuration>                             <skip>false</skip>                                 <include>**/When*.*</include>                             <includes>                             </includes>                                 <include>**/When*.*</include>                             <excludes>                             </includes>                             <excludes>                                 <exclude>%regex[.*integration.*When.*]</exclude>                                 <exclude>%regex[.*integration.*When.*]</exclude>                             </excludes>                             </excludes>                         </configuration>                         </configuration>                     </execution>                     </execution>                     <execution>                         <id>integration-tests</id> Excluding integration tests from the test phase                         <phase>integration-test</phase>                         <goals>                             <goal>test</goal>                         </goals>                         <configuration>                             <skip>false</skip>                             <includes>                                 <include>%regex[.*integration.*]</include>                             </includes>                         </configuration>                     </execution> Using package conventions                 </executions>             </plugin>
  • 37. Split unit and integration tests            <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-surefire-plugin</artifactId>                 <version>2.11</version>                 <configuration>                     <skip>true</skip>                 </configuration>                 <executions>                     <execution>                         <id>unit-tests</id> Run only integration tests in the integration-test phase                         <phase>test</phase>                         <goals>                             <goal>test</goal>                         </goals>                     <execution>                         <configuration>                         <id>integration-tests</id>                             <skip>false</skip>                             <includes>                         <phase>integration-test</phase>                                 <include>**/When*.*</include>                         <goals>                             </includes>                             <goal>test</goal>                             <excludes>                                 <exclude>%regex[.*integration.*When.*]</exclude>                         </goals>                             </excludes>                         <configuration>                         </configuration>                             <skip>false</skip>                     </execution>                     <execution>                             <includes>                         <id>integration-tests</id>                                 <include>%regex[.*integration.*]</include>                         <phase>integration-test</phase>                         <goals>                             </includes>                             <goal>test</goal>                         </configuration>                         </goals>                     </execution>                         <configuration>                             <skip>false</skip>                             <includes>                                 <include>%regex[.*integration.*]</include>                             </includes>                         </configuration>                     </execution> Using package conventions                 </executions>             </plugin>
  • 38. Compile Default build Unit Test mvn deploy Package Integration Test
  • 39. Compile Default build Unit Test mvn install Package Integration Test Jenkins Artifactory Plugin
  • 40. Compile Default build Unit Test mvn install Package Integration Test mvn deploy:deploy
  • 42. Run code coverage with the integration tests compile test-compile Integration tests mvn verify test package integration-test verify Test coverage mvn cobertura compile test-compile Duplication! test package integration-test cobertura Creates its own instrumented JAR files
  • 43. JACOCO Java Code Coverage Code coverage on the fly Doesn’t mess with your JAR files
  • 44. Run code coverage with the integration tests <plugin>     <groupId>org.jacoco</groupId>     <artifactId>jacoco-maven-plugin</artifactId>     <version>0.5.10.201208310627</version>     <executions>         <execution>             <id>jacoco-initialize</id>             <goals>                 <goal>prepare-agent</goal>             </goals> Measure code coverage         </execution> after the integration tests         <execution>             <id>jacoco-site</id>             <phase>post-integration-test</phase>             <goals>                 <goal>report</goal>             </goals>         </execution>     </executions> </plugin>
  • 45.            <plugin> Run code coverage with the integration tests                <groupId>org.jacoco</groupId>                <artifactId>jacoco-­‐maven-­‐plugin</artifactId>                <executions>                    <execution>                        <goals>                            <goal>prepare-­‐agent</goal>                        </goals>                    </execution>                    <execution>                        <id>check</id>                        <goals>                            <goal>check</goal> Define minimum coverage                        </goals>                        <phase>post-­‐integration-­‐test</phase>                        <configuration>                            <check>                                <classRate>95</classRate>                                <instructionRate>95</instructionRate>                                <methodRate>90</methodRate>                                <branchRate>95</branchRate>                                <complexityRate>95</complexityRate>                                <lineRate>95</lineRate>                            </check>                        </configuration>                    </execution>
  • 46. Run code coverage with the integration tests Integration tests/test compile test-compile mvn install test coverage package integration-test verify Uninstrumented JAR Coverage checks and report
  • 47. Minimal overhead Build Time Normal build With JaCoCo
  • 48. Reuse binaries wherever possible Default build 1.0.203 Deploy to TEST Acceptance Tests 1.0.201 1.0.202 1.0.203 Deploy to UAT
  • 49. Have a separate acceptance test suite Acceptance Tests TEST UAT PROD
  • 50. Take code quality seriously Checkstyle Findbugs
  • 51. Take code quality seriously Code quality metrics mvn site
  • 52. Take code quality seriously Pick and choose your metrics Code quality metrics mvn pmd:check mvn findbugs:check mvn checkstye:checkstyle Fail the build if there are violations
  • 53. Avoid the Maven Release Plugin Don’t sweat the version numbers
  • 54. Developers always work on a SNAPSHOT version 1.0-SNAPSHOT This number is pretty arbitrary
  • 55. Jenkins sets a release candidate version at the start of the build pipeline 1.0-SNAPSHOT 1.0.203 This number is a build counter
  • 56. This version goes through the build pipeline 1.0.203 Unit tests Acceptance tests Code quality metrics Deploy to TEST
  • 57. This version goes through the build pipeline 1.0.203 1.0.204 1.0.205 Unit tests Acceptance tests Code quality metrics Deploy to TEST Acceptance Tests 1.0.203 1.0.204 1.0.205
  • 58. Create a new release branch Update the version number Build and test release candidate Did it work? No Yes Drop release branch Push release branch Notify everyone Deploy release candidate
  • 59. Create a new release branch Update the version number Build and test release candidate 1.0.203 Did it work? No Yes Drop release branch Push release branch Notify everyone Deploy release candidate
  • 60. Create a new release branch Update the version number Versions Plugin Build and test release candidate mvn versions:set -DnewVersion=1.0.203 Did it work? No Yes Drop release branch Push release branch Notify everyone Deploy release candidate
  • 61. Create a new release branch Update the version number Build and test release candidate Did mvn verify ... it work? No Yes Drop release branch Push release branch Notify everyone Deploy release candidate
  • 62. And make it visible The Build Pipeline plugin
  • 63. Let’s see it in action! TEST UAT PROD Jenkins
  • 64. Let’s see it in action!
  • 65. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 66. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 67. initial-build Links to binary artifacts in Artifactory Release candidate number
  • 68. initial-build Links to binary artifacts in Artifactory
  • 69. initial-build Use a parameterized build to configure the major build version Users can override the default major version
  • 70. initial-build Create a new branch Update the version in the pom files Build the binaries
  • 71. initial-build Conditional build step plugin If the build succeeds... Commit the changes and push the branch to the repository
  • 72. initial-build If the build fails... Delete the branch
  • 73. initial-build Deploy the release candidate to Artifactory
  • 74. initial-build Deploy to the test environment Target platform
  • 75. initial-build <plugin> <groupId>com.jelastic</groupId> <artifactId>jelastic-maven-plugin</artifactId> <version>1.6</version> <configuration> <email>${jelastic.username}</email> <password>${jelastic.password}</password> <context>${jelastic.context}</context> <environment>${jelastic.environment}</environment> <api_hoster>app.jelastic.servint.net</api_hoster> </configuration> </plugin>
  • 76. initial-build Archive binary Update the build description
  • 77. initial-build Archive binary Pass the release branch to the next build job
  • 78. initial-build Don’t start a new build pipeline if one is currently running.
  • 79. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 80. initial-build code-quality Pass in the release we want to build against deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 81. initial-build code-quality deploy-to-test Build from the release candidate branch acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 82. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 83. initial-build code-quality Copy the WAR file from the initial build deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 84. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat ...deploy this WAR file acceptance-tests deploy-to-prod
  • 85. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod the acceptance tests ...and run
  • 86. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat What platform do we run the acceptance test against acceptance-tests deploy-to-prod
  • 87. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat What platform do we run the acceptance test against acceptance-tests deploy-to-prod
  • 88. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 89. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat What platform do we run the acceptance test against acceptance-tests deploy-to-prod
  • 90. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat What platform do we run the acceptance test against acceptance-tests deploy-to-prod
  • 91. initial-build code-quality deploy-to-test acceptance-tests deploy-to-uat Build promotion status acceptance-tests deploy-to-prod
  • 92. initial-build Copy the WAR file from the initial build... code-quality deploy-to-test acceptance-tests deploy-to-uat ...and deploy it to UAT acceptance-tests deploy-to-prod
  • 93. A build promotioninitial-build deploy to production process to code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 94. A build promotioninitial-build deploy to production process to code-quality deploy-to-test acceptance-tests deploy-to-uat acceptance-tests deploy-to-prod
  • 95. Build pipeline for an overview of the process
  • 96. Thank You John  Ferguson  Smart Email:  john.smart@wakaleo.com Web:  hHp://www.wakaleo.com TwiHer:  wakaleo