SlideShare a Scribd company logo
1 of 61
Download to read offline
Making Agile Real


Automated deployment with Maven and friends
            Going the whole nine yards



  John Ferguson Smart
  Principle Consultant
  Wakaleo Consulting




                                                        1
Presentation Goals
Learn about how build automation techniques can also be
            used to deploy your application




                     Agile2009 - Making Agile Real
                                                          2
Speaker’s qualifications
John Ferguson Smart
Consultant, Trainer, Mentor, Author,...
Works with Enterprise Java, Web Development,
and Open Source technologies
Author of ‘Java Power Tools’ (O’Reilly)
Writes articles for sites like JavaWorld, DevX and
Java.net, and blogs on Java.net
Frequent speaker at conferences and Java User
Groups
Likes to write about himself in the third person


                       Agile2009 - Making Agile Real
                                                       3
Agenda
What will we cover today
Build automation fundamentals
The Maven Release Cycle
The role of the Maven Enterprise Repository
Automating Deployment
Automating Web Testing
Automating Web Deployment
Deploying Database Updates
Scripting the Deployment Process
A real-world example

                       Agile2009 - Making Agile Real
                                                       4
Build automation
   Build automation - the Big Three
                         maven
                                                         Build scripting


Automated code quality

                                              JUnit
                                                                    Automated testing




                         Agile2009 - Making Agile Real
                                                                                        5
Build automation
Step 4 - Automate your deployment process!




                   Agile2009 - Making Agile Real
                                                   6
Release automation - an overview
                                                                      4) Database updates
                                              maven
                  5) Groovy build scripting



                                                                                               Database
                  1) Maven Release Cycle      Build script
                                                                                          2) Automated deployments

  Continuous Integration




                                                                                              Application server

CI build server


                                                                              3) Automated web tests

                   SCM server                  Enterprise
                                               Repository
                                              Agile2009 - Making Agile Real
                                                                                                                     7
Release Foundations
Building your release process on solid building blocks:
The Maven Enterprise Repository
The Maven Release Cycle




                                                          1.0.1-SNAPSHOT



                                                             1.0.1


                                                    1.0.2-SNAPSHOT




                    Agile2009 - Making Agile Real
                                                                           8
The Maven Enterprise Repository
     The Maven Enterprise Repository
       A proxy/cache for public libraries
       A repository for internal libraries
        Snapshots
        Releases



                    WAR
                          1.0.1


                                                          WAR
                                                                  1.0.1

                                                  Enterprise
                                                  Repository
CI build server


                                  Agile2009 - Making Agile Real
                                                                          9
The Maven Enterprise Repository
The Maven Enterprise Repository
Several options available
 Nexus
 Artifactory
 Archiva
 File server...




                      Agile2009 - Making Agile Real
                                                      10
The Maven Release Cycle
The Maven Release Cycle
Develop against snapshot versions
                                                                    1.0.1-SNAPSHOT




 Each release produces a new time-stamped artifact                     1.0.1


                                                              1.0.2-SNAPSHOT
 Snapshot versions are identified by the SNAPSHOT
 keyword
Release stable versions               <groupId>myorg.myapp</groupId>
                                      <artifactId>myapp-web</artifactId>
 Stable, tested release
                                      <version>1.0.0-SNAPSHOT</version>
 Each artifact is unique

                                      <groupId>myorg.myapp</groupId>
                                      <artifactId>myapp-web</artifactId>
                                      <version>1.0.0</version>



                           Agile2009 - Making Agile Real
                                                                                 11
The Maven Release Cycle
Deploying a release involves many tasks
Commit all current changes to version control
Upgrade the version number(s) and commit the changes
Tag the release version
Build and deploy this version
Update the version number and commit the changes




                      Agile2009 - Making Agile Real
                                                       12
The Maven Release Cycle
The Maven Release Plugin automates this process
Automates the release process
Updates version numbers
Commits changes and creates new SCM tags
Builds, tests and deploys to the Enterprise Repository




                      Agile2009 - Making Agile Real
                                                         13
The Maven Release Cycle
    Try this at home!
      You will need:
       A valid SCM configuration
       The maven-release-plugin

  <scm>
    <connection>scm:git:git://github.com/wakaleo/babble.git</connection>
    <developerConnection>scm:git:git://github.com/wakaleo/babble.git
    </developerConnection>
  </scm>
                     <plugin>
                       <groupId>org.apache.maven.plugins</groupId>
                       <artifactId>maven-release-plugin</artifactId>
                       <configuration>
Need this for multi-     <preparationGoals>clean verify install</preparationGoals>
                       </configuration>
 module projects     </plugin>




                                   Agile2009 - Making Agile Real
                                                                                     14
The Maven Release Cycle
Using the Maven Release Plugin
$ mvn release:prepare
Audits your code...
 Check that there is no uncommitted code
 Check that there are no snapshot dependencies
 Prompts for release tag, branch and new version numbers




                       Agile2009 - Making Agile Real
                                                           15
The Maven Release Cycle
Using the Maven Release Plugin
$ mvn release:prepare
...then does the bookkeeping
 Updates version numbers to release versions
 Creates a new release tag in SCM
 Updates version numbers to next SNAPSHOT versions
 Commit these changes to SCM


                                                            1.0.1

             1.0.1-SNAPSHOT
                       1.0.1
                                                         SCM server
                  1.0.2-SNAPSHOT
                         Agile2009 - Making Agile Real
                                                                      16
The Maven Release Cycle
The Maven Release Plugin - interactive or automated?
$ mvn release:prepare
By default, Maven will prompt you for:
 Release version number
 Release tag
 Next snapshot version number

This is not appropriate for automated builds
                                                        No questions asked
 $ mvn release:prepare -B
 Use batch mode to use sensible default values



                        Agile2009 - Making Agile Real
                                                                             17
The Maven Release Cycle
 Using the Maven Release Plugin
  $ mvn release:perform
  Do the real work
   Checkout a release version
   Build, test and deploy to the Enterprise repository




SCM server       1.0.1                                     1.0.1   Enterprise
                                                                   Repository


                           Agile2009 - Making Agile Real
                                                                                18
The Maven Release Cycle
 Automating the Maven Release Plugin
  Don’t use the maven-release-plugin on your own machine
  Run it on a build server instead
   Accessible to all
   Reference environment
   No risk of local code changes




SCM server       1.0.1                                     1.0.1   Enterprise
                                                                   Repository
                              CI build server

                           Agile2009 - Making Agile Real
                                                                                19
Automated deployment
   Automating the deployment process
    Don’t rebuild, reuse!
      Download application binaries from the Enterprise repository
      Externalize configuration as much as possible
      Patch if necessary with target environment configuration
      Deploy to target environment



               WAR                                           WAR

                1.0.1                                        1.0.1
Enterprise                   CI build                                Application
Repository                   server                                    Server


                             Agile2009 - Making Agile Real
                                                                                   20
Automated deployment
Deployment strategies - direct reuse
Reuse from the repository without modification
Externalized environment-specific configuration
 JNDI
 Local environment-specific properties files
 ...



                             WAR

                              1.0.1
        Enterprise                                      Application
        Repository                                        Server

                        Agile2009 - Making Agile Real
                                                                      21
Automated deployment
Deployment strategies - patching
Reuse binaries from the repository
Modify internal configuration files for the target environment
Can use overlays in Maven                                                        ectly!
                                                                        i  es dir
                                                                 r binar
                                                  p     lo y you
                                      u ca n’t de
                                   o
                            ly if y
                      ing on
          Use patch
 N OTE:

                                       WAR

                                        1.0.1
          Enterprise                                              Application
          Repository                                                Server

                                  Agile2009 - Making Agile Real
                                                                                          22
Automated deployment
Patching - Deploying a web application in 5 easy steps!
                                            Create a deployment project

                                           Most of the directories are empty


                                             These are the files that will patch the
                                                 web application for different
                                                        environments




                    Agile2009 - Making Agile Real
                                                                                      23
Automated deployment
Patching - Deploying a web application in 5 easy steps!
<dependency>
  <groupId>myorg.myapp</groupId>          Add a parameterized dependency
  <artifactId>myapp-web</artifactId>               to your WAR
  <version>${webapp.version}</version>
  <type>war</type>
</dependency>
...
<properties>
  <webapp.version>${project.version}</webapp.version>
</properties>

                                              Provide a sensible default
                                                    target version




                             Agile2009 - Making Agile Real
                                                                           24
Automated deployment
Patching - Deploying a web application in 5 easy steps!
<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>                               Incorporate the web application, but
         <warName>myapp-web</warName>              exclude the files to be patched
    <overlays>
      <overlay>
        <groupId>myorg.myapp</groupId>
        <artifactId>myapp-web</artifactId>
        <excludes>
           <exclude>WEB-INF/classes/config.properties</exclude>
        </excludes>
      </overlay>
      ...




                               Agile2009 - Making Agile Real
                                                                                       25
Automated deployment
Patching - Deploying a web application in 5 easy steps!
<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    ...
    <webResources>
      <resource>
        <directory>${patch.path}</directory>
      </resource>
    </webResources>
  </configuration>
</plugin>
...
                              Include patched files in the final bundle




                             Agile2009 - Making Agile Real
                                                                        26
Automated deployment
   Patching - Deploying a web application in 5 easy steps!
<profile>                                   The exact              patch files is defined in profiles
  <id>dev</id>
  <properties>
    <patch.path>src/main/patches/dev</patch.path>
  </properties>
</profile>

                                                   For staging and production, you can also
    <profile>                                        override the version being deployed
      <id>staging</id>
      <properties>
        <patch.path>src/main/patches/staging</patch.path>
        <webapp.version>${target.version}</webapp.version>
      </properties>                                                      Provide the version to be
    </profile>
                                                                         deployed as a parameter

        $ mvn package -Dtarget.version=1.0.5 -Pstaging                    The profile indicates the
                                                                            target environment


                                   Agile2009 - Making Agile Real
                                                                                                     27
Automated web deployment
Automating the deployment process with Cargo
Start, stop and install application servers
Deploy to different application servers
Run a stand-alone instance
Or deploy to an existing server
                     Deploy to different application servers


                                   WAR




Run Cargo locally




                       Agile2009 - Making Agile Real
                                                               28
Automated web deployment
Deploying to an embedded Jetty instance
The simplest way to use Cargo with Maven
 <project>
     <build>
         ...                                                                      Use the Cargo Maven plugin
         <plugins>
           <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <version>1.0</version>
           </plugin>
         </plugins>
     </build>
                                                  Start embedded Jetty instance
 $ mvn cargo:start
 ...
 [INFO] [cargo:start]
 [INFO] No container defined, using a default [jetty6x, embedded] container
 [INFO] [beddedLocalContainer] Jetty 6.x Embedded starting...
 ...
 2009-07-21 16:47:36.470::INFO: Started SelectChannelConnector @ 0.0.0.0:8080
 [INFO] [beddedLocalContainer] Jetty 6.x Embedded started on port [8080]
 [INFO] Press Ctrl-C to stop the container...
                                                                   Jetty is now running


                                       Agile2009 - Making Agile Real
                                                                                                               29
Automated web deployment
Deploying to a “real” application server
Deploy to a locally installed instance
Download and install a server as required
Deploy to a running server
Start and stop a server
...



                                   WAR




                       Agile2009 - Making Agile Real
                                                       30
Automated web deployment
Deploying to a local Tomcat server
<project>
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>             Use a locally-installed Tomcat
        <version>1.0</version>                                            installation
       <configuration>
         <container>
           <containerId>tomcat6x</containerId>
          <home>/usr/local/tomcat</home>                           Tomcat home directory goes here
         </container>
         <configuration>
           <type>standalone</type>
           <home>target/tomcat6x</home>
         </configuration>
       </configuration>
     </plugin>
   </plugins>
 </build>




                                 Agile2009 - Making Agile Real
                                                                                                     31
Automated web deployment
Deploying to a local Tomcat server
<project>
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0</version>
       <configuration>                                Or download a copy of Tomcat...
         <container>
           <containerId>tomcat6x</containerId>
           <zipUrlInstaller>
             <url>http://www.ibiblio.org/.../tomcat-6.0.20.zip</url>
             <installDir>${user.home}/tools/tomcat</installDir>
          </zipUrlInstaller>
         </container>
         <configuration>
           <type>standalone</type>                          ...and install it here
           <home>target/tomcat6x</home>
         </configuration>
       </configuration>
      </plugin>
    </plugins>
  </build>



                                 Agile2009 - Making Agile Real
                                                                                        32
Automated web deployment
Deploying to a remote server
<project>
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0</version>                                Deploy to a remote server
        <configuration>
          <container>
            <containerId>tomcat6x</containerId>
            <type>remote</type>
          </container>
          <configuration>
            <type>runtime</type>
            <properties>
              <cargo.remote.username>admin</cargo.remote.username>
              <cargo.remote.password></cargo.remote.password>
              <cargo.tomcat.manager.url>
              http://appserver.acme.com:8888/manager
              </cargo.tomcat.manager.url>
            </properties>
          </configuration>                                         Use these properties to connect
        </configuration>
      </plugin>                                                              to the server
    </plugins>
  </build>

                                    Agile2009 - Making Agile Real
                                                                                                     33
Automated web deployment
Deploying a separate WAR file
<plugin>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-maven2-plugin</artifactId>
  <version>1.0</version>                                        Deploy a WAR file defined in the
  <configuration>                                                       dependency list
    <container>...</container>
    <configuration>...</configuration>
   <deployer>
    <deployables>                                                   The exact version of the WAR is
      <deployable>
                                                                             defined here
        <artifactId>ebank-web</artifactId>
        <groupId>org.ebank</groupId>
        <type>war</type>
      </deployable>
    </deployables>              <dependencies>
                                  <dependency>
  </deployer>
                                         <groupId>org.ebank</groupId>
  </configuration>
                                         <artifactId>ebank-web</artifactId>
</plugin>
                                         <type>war</type>
...
                                         <version>${target.version}</version>
                                      </dependency>
                                     </dependencies>

                                     <properties>
                                       <target.version>${project.version}</target.version>
                                     </properties>


                                Agile2009 - Making Agile Real
                                                                                                      34
Automated web deployment
Deploying a separate WAR file



                     1.0.1

           WAR
                 1.0.1




                              maven
                                                             WAR
                                                                   1.0.1




                                                                           Production
                                                                             server
                             Agile2009 - Making Agile Real
                                                                                        35
Automated web testing
Automated functional/web tests
Many tools available:
 Selenium
 HTMLUnit
 JWebUnit
 Canoo Webtest
 ...
And many strategies:
 Run tests before deployment
 Run tests against the deployed application



                        Agile2009 - Making Agile Real
                                                        36
Automated web testing
Basic principle - don’t rebuild, deploy!
Create a special Maven project to run your web tests



 myapp                             mvn deploy

 myapp-core
  myapp-service     WAR

                    1.0.1
   myapp-web

                   WAR
 myapp-webtest                         <dependency>


                             Now run tests as usual

                         Agile2009 - Making Agile Real
                                                         37
Automated web testing
Basic principle - don’t rebuild, deploy!
Create a special Maven project to run your web tests



 myapp                          mvn deploy

 myapp-core
  myapp-service     WAR

                    1.0.1
   myapp-web                                              WAR




 myapp-webtest
                                                                Test server
                     Or run tests against a test server


                      Agile2009 - Making Agile Real
                                                                              38
Automated web testing
Basic principle - don’t rebuild, deploy!
Create a special Maven project to run your web tests



 myapp                          mvn deploy

 myapp-core
  myapp-service     WAR

                    1.0.1
   myapp-web
                                                       WAR




 myapp-webtest

                    Or deploy to and test a production server   Production
                                                                  server
                      Agile2009 - Making Agile Real
                                                                             39
Automated web testing
Testing Snapshots or Release Candidates - an approach
Use a dedicated release candidate branch
 Changes are merged into the release candidate branches when ready
 Automated tests are (also) run against the release candidate branch
 Releases are run against the release candidate branch
 Updated version numbers need to be merged back to the trunk
                                                        development trunk




                                                        release candidate branch


                                       mvn release
                        Agile2009 - Making Agile Real
                                                                                   40
Automated web testing
Testing Snapshots or Release Candidates - an approach
Use multiple repositories on your Enterprise server

    release candidate branch
                                               Deploy to Release     snapshots
 myapp
                                              Candidate repository     releases
 myapp-core                                                                release
                                                                         candidates
  myapp-service                WAR

                                 1.0.1-SNAPSHOT
   myapp-web

                               WAR
 myapp-webtest                                     <dependency>


                                         Now run tests as usual

                                     Agile2009 - Making Agile Real
                                                                                      41
Deploying Database Updates
But what about database updates?
Schema updates
Data updates
Data migration
Database backups and updates
Rollbacks




                   Agile2009 - Making Agile Real
                                                   42
Deploying Database Updates
Several approaches and tools exist, e.g.
Manual SQL scripts
Hibernate
Liquibase
...




                     Agile2009 - Making Agile Real
                                                     43
Deploying Database Updates
Liquibase - smart database updates
Open source tool for managing database changes
Database changes are stored in XML form in the SCM
Database neutral
Many powerful features
 Roll back changes
 Merge changes from several developers
 Generate a SQL update script that a DBA can apply
 ...




                       Agile2009 - Making Agile Real
                                                       44
Deploying Database Updates
  Liquibase change sets
    Database changes recorded manually in XML
    More work, but allows more intelligent rollbacks
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.6"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.6
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.6.xsd">
                                                                      Each changeset is unique
    <changeSet id="1" author="john">
        <createTable tableName="department">                                Create a new table
            <column name="id" type="int">
                 <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                 <constraints nullable="false"/>
            </column>
            <column name="active" type="boolean" defaultValue="1"/>
        </createTable>
    </changeSet>
</databaseChangeLog>


                                    Agile2009 - Making Agile Real
                                                                                                 45
Deploying Database Updates
 Liquibase change sets
  Lots of types of changes are supported
   DDL updates (add, modify or drop tables, columns or indexes...)
<databaseChangeLog...>
                                                                  Add a new column
    <changeSet id="2" author="simon">
        <addColumn tableName="department">
            <column name="description" type="varchar(50)"/>
        </addColumn>
        <dropColumn tableName="department" columnName="telex" >
    </changeSet>
</databaseChangeLog>
                                                                  Drop a column




                               Agile2009 - Making Agile Real
                                                                                     46
Deploying Database Updates
 Liquibase change sets
  Lots of types of changes are supported
    DDL updates (add, modify or drop tables, columns or indexes...)
    Insert data...
<databaseChangeLog...>
                                                                  Insert a row of data
    <changeSet id="4" author="john">
        <insert tableName="country">
            <column name="id" valueNumeric="1"/>
            <column name="code" value="AL"/>
            <column name="name" value="Albania"/>
        </addColumn>
    </changeSet>
</databaseChangeLog>
  <databaseChangeLog...>
      <changeSet id="3" author="simon">
          <loadData tableName="countries" file="countries.csv">
              <column name="id" type="NUMERIC"/>
              <column name="code" type="STRING"/>               Upload data from a file
              <column name="name" type="STRING"/>
          </loadData>
      </changeSet>
  </databaseChangeLog>

                                  Agile2009 - Making Agile Real
                                                                                         47
Deploying Database Updates
    Integration with Maven
<project>
  <build>
    <plugins>                                                  Use the Maven Liquibase plugin
      <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-plugin</artifactId>
        <version>1.9.3.0</version>
        <configuration>
           <propertyFileWillOverride>true</propertyFileWillOverride>
           <propertyFile>src/main/resources/liquibase.properties</propertyFile>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...                                              changeLogFile = changelog.xml
</project>                                         driver = com.mysql.jdbc.Driver
                                                   url = jdbc:mysql://localhost/ebank
                                                   username = scott
                                                   password = tiger
                                                   verbose = true
                       And a configuration file      dropFirst = false
                                                                 liquibase.properties

                                     Agile2009 - Making Agile Real
                                                                                                48
Deploying Database Updates
  Integration with Maven
   Commands can be run directly or as part of the lifecycle,
   e.g.
                                                       Update any unimplemented changes
           $ mvn liquibase:update




$ mvn liquibase:rollback -Dliquibase.rollbackCount=1



                                                                     Rollback latest changes
            mvn liquibase:updateSQL




                                    Generate SQL update script



                                Agile2009 - Making Agile Real
                                                                                               49
Scripting the deployment process
Real-world deployments are complex
Deployments to application servers
Database backups and updates
Web service deployments
...
Some tasks need to be manual...
...but many don’t




                     Agile2009 - Making Agile Real
                                                     50
Scripting the deployment process
Deployment scripting - Groovy is your friend!
 Close to Java
 Concise and readable
 Great for file manipulation

How can you use Groovy?
 Use a dedicated Maven project to fetch and/or prepare the artifact
 Call the Groovy script from your Maven deployment project
 Or wrap the Maven script in Groovy and add the more specific tasks




                         Agile2009 - Making Agile Real
                                                                      51
Scripting the deployment process
Using Groovy Scripting in Maven
 Just use the GMaven plugin
  Embed Groovy script in your pom.xml file
  Run an external Groovy script
  Use elements of your pom.xml or settings.xml in your script




                        Agile2009 - Making Agile Real
                                                                52
Scripting the deployment process
Using Groovy Scripting in Maven
  Just use the GMaven plugin

<build>
   <plugins>
    <plugin>
      <groupId>org.codehaus.groovy.maven</groupId>
      <artifactId>gmaven-plugin</artifactId>
      <version>1.0-rc-5</version>                Run some Groovy code
      <configuration>
         <source>
        println "Hi there, I’m ${user.name}. My project is ${project.name}"
         </source>
      </configuration>
    </plugin>
  </plugins>                               You can use objects from your pom.xml   file
</build>




                              Agile2009 - Making Agile Real
                                                                                         53
Scripting the deployment process
Using Groovy Scripting in Maven
  Another example - invoking another Groovy script
                                                               <settings...>
<build>                                                          <servers>
                                                                   <server>
   <plugins>                                                         <id>dbserver</id>
    <plugin>                                                         <username>scott</username>
                                                                     <password>tiger</password>
      <groupId>org.codehaus.groovy.maven</groupId>                 </server>
                                                                 </servers>
      <artifactId>gmaven-plugin</artifactId>                     ...
      <version>1.0-rc-5</version>                              </settings>             settings.xml
      <configuration>
         <source>
                           Fetch username and password details from the settings.xml         file
        def server = settings.servers.find{ it.id.equals('dbserver') }
        """groovy update-scripts.groovy -Ddb.username=${server.username}
            -Ddb.password=${server.password}""".execute()
         </source>
      </configuration>
    </plugin>               Invoke an external Groovy script and provide the
  </plugins>                     username and password as parameters
</build>


                               Agile2009 - Making Agile Real
                                                                                                      54
An example: JIRA and Bamboo
Automating the release process with JIRA and Bamboo
        Issues, releases, and                                       Automated builds
          version numbers                                           and deployments

                                      List of available versions
                                1.0.0
                                 1.0.1
                                   1.0.2
                                                 1.0.2


                                              maven

                                WAR
                                      1.0.2                        App Server


                            Agile2009 - Making Agile Real
                                                                                       55
Example: JIRA and Bamboo
Automating the release process with JIRA and Bamboo




                  Agile2009 - Making Agile Real
                                                      56
Example: JIRA and Bamboo
Automating the release process with JIRA and Bamboo




                  Agile2009 - Making Agile Real
                                                      57
And in Hudson?
Use the “parameterized build” plugin




                                                    Add parameters to your build job




                    Agile2009 - Making Agile Real
                                                                                       58
And in Hudson?
Use the “parameterized build” plugin




                                                  Hudson prompts you for the
                                                parameter when you run the build




                    Agile2009 - Making Agile Real
                                                                                   59
In conclusion
What have we covered?
Using the Maven Release Cycle
Nexus as a cornerstone of the deployment process
Cargo to automate your application deployment
Liquibase to manage your database updates
Using Groovy in your Maven builds




                    Agile2009 - Making Agile Real
                                                    60
John Ferguson Smart
                                         Email: john.smart@wakaleo.com
                                          Web: http://www.wakaleo.com
                                                         Twitter: wakaleo




Thanks for your attention




         Agile2009 - Making Agile Real
                                                                       61

More Related Content

What's hot

An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache MavenRajind Ruparathna
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svnAnkur Goyal
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 
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
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for DummiesTomer Gabel
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 featuresAngel Ruiz
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with MavenSid Anand
 
Log management (elk) for spring boot application
Log management (elk) for spring boot applicationLog management (elk) for spring boot application
Log management (elk) for spring boot applicationVadym Lotar
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and AntDavid Noble
 
Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01rhemsolutions
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeHolasz Kati
 

What's hot (20)

An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
Maven basics
Maven basicsMaven basics
Maven basics
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Maven ppt
Maven pptMaven ppt
Maven ppt
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
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
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for Dummies
 
Apache Maven In 10 Slides
Apache Maven In 10 SlidesApache Maven In 10 Slides
Apache Maven In 10 Slides
 
Maven Overview
Maven OverviewMaven Overview
Maven Overview
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Log management (elk) for spring boot application
Log management (elk) for spring boot applicationLog management (elk) for spring boot application
Log management (elk) for spring boot application
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 
Introduction to maven
Introduction to mavenIntroduction to maven
Introduction to maven
 
Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction maven3 and gwt2.5 rc2 - Lesson 01
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafe
 

Viewers also liked

Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Hpca2012 facebook keynote
Hpca2012 facebook keynoteHpca2012 facebook keynote
Hpca2012 facebook keynoteparallellabs
 
Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Matthew McCullough
 
Why should C-Level care about APIs? It's the new economy, stupid.
Why should C-Level care about APIs? It's the new economy, stupid.Why should C-Level care about APIs? It's the new economy, stupid.
Why should C-Level care about APIs? It's the new economy, stupid.Fabernovel
 
如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理howie YU
 
Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...
Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...
Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...Fabernovel
 
The JSON-based Identity Protocol Suite
The JSON-based Identity Protocol SuiteThe JSON-based Identity Protocol Suite
The JSON-based Identity Protocol SuiteTwobo Technologies
 
Fidor TecS AG Company Presentation
Fidor TecS AG Company PresentationFidor TecS AG Company Presentation
Fidor TecS AG Company PresentationFrank Schwab
 
The end of polling (Audrey Neveu)
The end of polling (Audrey Neveu)The end of polling (Audrey Neveu)
The end of polling (Audrey Neveu)Nordic APIs
 
The future of Banking @ Social Media Week 2015
The future of Banking @ Social Media Week 2015The future of Banking @ Social Media Week 2015
The future of Banking @ Social Media Week 2015Lars Markull
 
Why Drones are the Future of IoT
Why Drones are the Future of IoTWhy Drones are the Future of IoT
Why Drones are the Future of IoTColin Snow
 
Jenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated DeploymentJenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated DeploymentDan Stine
 
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...Sonatype
 
Maven 2 in the real world
Maven 2 in the real worldMaven 2 in the real world
Maven 2 in the real worldCarlo Bonamico
 
API Management architect presentation
API Management architect presentationAPI Management architect presentation
API Management architect presentationsflynn073
 
Streamlining Deployments in a Large Websphere Environment
Streamlining Deployments in a Large Websphere Environment Streamlining Deployments in a Large Websphere Environment
Streamlining Deployments in a Large Websphere Environment XebiaLabs
 

Viewers also liked (20)

Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Qcon
QconQcon
Qcon
 
Hpca2012 facebook keynote
Hpca2012 facebook keynoteHpca2012 facebook keynote
Hpca2012 facebook keynote
 
Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3
 
Why should C-Level care about APIs? It's the new economy, stupid.
Why should C-Level care about APIs? It's the new economy, stupid.Why should C-Level care about APIs? It's the new economy, stupid.
Why should C-Level care about APIs? It's the new economy, stupid.
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理如何利用Jira + structure 做需求管理
如何利用Jira + structure 做需求管理
 
Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...
Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...
Disrupting the Car Industry and Driver Experience with APIs - API Days San Fr...
 
The JSON-based Identity Protocol Suite
The JSON-based Identity Protocol SuiteThe JSON-based Identity Protocol Suite
The JSON-based Identity Protocol Suite
 
Fidor TecS AG Company Presentation
Fidor TecS AG Company PresentationFidor TecS AG Company Presentation
Fidor TecS AG Company Presentation
 
Maven and ANT
Maven and ANTMaven and ANT
Maven and ANT
 
The end of polling (Audrey Neveu)
The end of polling (Audrey Neveu)The end of polling (Audrey Neveu)
The end of polling (Audrey Neveu)
 
The future of Banking @ Social Media Week 2015
The future of Banking @ Social Media Week 2015The future of Banking @ Social Media Week 2015
The future of Banking @ Social Media Week 2015
 
Why Drones are the Future of IoT
Why Drones are the Future of IoTWhy Drones are the Future of IoT
Why Drones are the Future of IoT
 
Jenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated DeploymentJenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated Deployment
 
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
 
EVOLVE'13 | Keynote | Roy Fielding
EVOLVE'13 | Keynote | Roy FieldingEVOLVE'13 | Keynote | Roy Fielding
EVOLVE'13 | Keynote | Roy Fielding
 
Maven 2 in the real world
Maven 2 in the real worldMaven 2 in the real world
Maven 2 in the real world
 
API Management architect presentation
API Management architect presentationAPI Management architect presentation
API Management architect presentation
 
Streamlining Deployments in a Large Websphere Environment
Streamlining Deployments in a Large Websphere Environment Streamlining Deployments in a Large Websphere Environment
Streamlining Deployments in a Large Websphere Environment
 

Similar to Automated Deployment with Maven - going the whole nine yards

Software Testen mit Visual Studio Lab Management
Software Testen mit Visual Studio Lab ManagementSoftware Testen mit Visual Studio Lab Management
Software Testen mit Visual Studio Lab ManagementNico Orschel
 
Jdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsJdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsMert Çalışkan
 
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
 
Optimising Productivity with AWS Developer Tools
Optimising Productivity with AWS Developer ToolsOptimising Productivity with AWS Developer Tools
Optimising Productivity with AWS Developer ToolsAmazon Web Services
 
Jabox presentation
Jabox presentationJabox presentation
Jabox presentationspiddy
 
Jabox presentation
Jabox presentationJabox presentation
Jabox presentationspiddy
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsAmazon Web Services
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaAmazon Web Services
 
Continuous delivery chernivcy
Continuous delivery chernivcyContinuous delivery chernivcy
Continuous delivery chernivcyVolodymyr Yelchev
 
Process Matters (Cloud2Days / Java2Days conference))
Process Matters (Cloud2Days / Java2Days conference))Process Matters (Cloud2Days / Java2Days conference))
Process Matters (Cloud2Days / Java2Days conference))dev2ops
 
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
 
Jabox presentation
Jabox presentationJabox presentation
Jabox presentationspiddy
 
maven build certificaton
maven build certificatonmaven build certificaton
maven build certificatonVskills
 
Automated testing DrupalCamp in Asheville
Automated testing DrupalCamp in AshevilleAutomated testing DrupalCamp in Asheville
Automated testing DrupalCamp in AshevillePromet Source
 
Team Development and Release Management
Team Development and Release ManagementTeam Development and Release Management
Team Development and Release ManagementSalesforce Partners
 
Build Tools-Introduction (3)
Build Tools-Introduction (3)Build Tools-Introduction (3)
Build Tools-Introduction (3)Manjyot Singh
 

Similar to Automated Deployment with Maven - going the whole nine yards (20)

Software Testen mit Visual Studio Lab Management
Software Testen mit Visual Studio Lab ManagementSoftware Testen mit Visual Studio Lab Management
Software Testen mit Visual Studio Lab Management
 
Hudson: from build jobs to build pipelines
Hudson: from build jobs to build pipelinesHudson: from build jobs to build pipelines
Hudson: from build jobs to build pipelines
 
Jdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsJdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent Projects
 
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
 
Optimising Productivity with AWS Developer Tools
Optimising Productivity with AWS Developer ToolsOptimising Productivity with AWS Developer Tools
Optimising Productivity with AWS Developer Tools
 
Jabox presentation
Jabox presentationJabox presentation
Jabox presentation
 
Jabox presentation
Jabox presentationJabox presentation
Jabox presentation
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 
Continuous delivery chernivcy
Continuous delivery chernivcyContinuous delivery chernivcy
Continuous delivery chernivcy
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Process Matters (Cloud2Days / Java2Days conference))
Process Matters (Cloud2Days / Java2Days conference))Process Matters (Cloud2Days / Java2Days conference))
Process Matters (Cloud2Days / Java2Days conference))
 
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...
 
Jabox presentation
Jabox presentationJabox presentation
Jabox presentation
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Maven nutshell
Maven nutshellMaven nutshell
Maven nutshell
 
maven build certificaton
maven build certificatonmaven build certificaton
maven build certificaton
 
Automated testing DrupalCamp in Asheville
Automated testing DrupalCamp in AshevilleAutomated testing DrupalCamp in Asheville
Automated testing DrupalCamp in Asheville
 
Team Development and Release Management
Team Development and Release ManagementTeam Development and Release Management
Team Development and Release Management
 
Build Tools-Introduction (3)
Build Tools-Introduction (3)Build Tools-Introduction (3)
Build Tools-Introduction (3)
 

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
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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...
 

Automated Deployment with Maven - going the whole nine yards

  • 1. Making Agile Real Automated deployment with Maven and friends Going the whole nine yards John Ferguson Smart Principle Consultant Wakaleo Consulting 1
  • 2. Presentation Goals Learn about how build automation techniques can also be used to deploy your application Agile2009 - Making Agile Real 2
  • 3. Speaker’s qualifications John Ferguson Smart Consultant, Trainer, Mentor, Author,... Works with Enterprise Java, Web Development, and Open Source technologies Author of ‘Java Power Tools’ (O’Reilly) Writes articles for sites like JavaWorld, DevX and Java.net, and blogs on Java.net Frequent speaker at conferences and Java User Groups Likes to write about himself in the third person Agile2009 - Making Agile Real 3
  • 4. Agenda What will we cover today Build automation fundamentals The Maven Release Cycle The role of the Maven Enterprise Repository Automating Deployment Automating Web Testing Automating Web Deployment Deploying Database Updates Scripting the Deployment Process A real-world example Agile2009 - Making Agile Real 4
  • 5. Build automation Build automation - the Big Three maven Build scripting Automated code quality JUnit Automated testing Agile2009 - Making Agile Real 5
  • 6. Build automation Step 4 - Automate your deployment process! Agile2009 - Making Agile Real 6
  • 7. Release automation - an overview 4) Database updates maven 5) Groovy build scripting Database 1) Maven Release Cycle Build script 2) Automated deployments Continuous Integration Application server CI build server 3) Automated web tests SCM server Enterprise Repository Agile2009 - Making Agile Real 7
  • 8. Release Foundations Building your release process on solid building blocks: The Maven Enterprise Repository The Maven Release Cycle 1.0.1-SNAPSHOT 1.0.1 1.0.2-SNAPSHOT Agile2009 - Making Agile Real 8
  • 9. The Maven Enterprise Repository The Maven Enterprise Repository A proxy/cache for public libraries A repository for internal libraries Snapshots Releases WAR 1.0.1 WAR 1.0.1 Enterprise Repository CI build server Agile2009 - Making Agile Real 9
  • 10. The Maven Enterprise Repository The Maven Enterprise Repository Several options available Nexus Artifactory Archiva File server... Agile2009 - Making Agile Real 10
  • 11. The Maven Release Cycle The Maven Release Cycle Develop against snapshot versions 1.0.1-SNAPSHOT Each release produces a new time-stamped artifact 1.0.1 1.0.2-SNAPSHOT Snapshot versions are identified by the SNAPSHOT keyword Release stable versions <groupId>myorg.myapp</groupId> <artifactId>myapp-web</artifactId> Stable, tested release <version>1.0.0-SNAPSHOT</version> Each artifact is unique <groupId>myorg.myapp</groupId> <artifactId>myapp-web</artifactId> <version>1.0.0</version> Agile2009 - Making Agile Real 11
  • 12. The Maven Release Cycle Deploying a release involves many tasks Commit all current changes to version control Upgrade the version number(s) and commit the changes Tag the release version Build and deploy this version Update the version number and commit the changes Agile2009 - Making Agile Real 12
  • 13. The Maven Release Cycle The Maven Release Plugin automates this process Automates the release process Updates version numbers Commits changes and creates new SCM tags Builds, tests and deploys to the Enterprise Repository Agile2009 - Making Agile Real 13
  • 14. The Maven Release Cycle Try this at home! You will need: A valid SCM configuration The maven-release-plugin <scm> <connection>scm:git:git://github.com/wakaleo/babble.git</connection> <developerConnection>scm:git:git://github.com/wakaleo/babble.git </developerConnection> </scm> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <configuration> Need this for multi- <preparationGoals>clean verify install</preparationGoals> </configuration> module projects </plugin> Agile2009 - Making Agile Real 14
  • 15. The Maven Release Cycle Using the Maven Release Plugin $ mvn release:prepare Audits your code... Check that there is no uncommitted code Check that there are no snapshot dependencies Prompts for release tag, branch and new version numbers Agile2009 - Making Agile Real 15
  • 16. The Maven Release Cycle Using the Maven Release Plugin $ mvn release:prepare ...then does the bookkeeping Updates version numbers to release versions Creates a new release tag in SCM Updates version numbers to next SNAPSHOT versions Commit these changes to SCM 1.0.1 1.0.1-SNAPSHOT 1.0.1 SCM server 1.0.2-SNAPSHOT Agile2009 - Making Agile Real 16
  • 17. The Maven Release Cycle The Maven Release Plugin - interactive or automated? $ mvn release:prepare By default, Maven will prompt you for: Release version number Release tag Next snapshot version number This is not appropriate for automated builds No questions asked $ mvn release:prepare -B Use batch mode to use sensible default values Agile2009 - Making Agile Real 17
  • 18. The Maven Release Cycle Using the Maven Release Plugin $ mvn release:perform Do the real work Checkout a release version Build, test and deploy to the Enterprise repository SCM server 1.0.1 1.0.1 Enterprise Repository Agile2009 - Making Agile Real 18
  • 19. The Maven Release Cycle Automating the Maven Release Plugin Don’t use the maven-release-plugin on your own machine Run it on a build server instead Accessible to all Reference environment No risk of local code changes SCM server 1.0.1 1.0.1 Enterprise Repository CI build server Agile2009 - Making Agile Real 19
  • 20. Automated deployment Automating the deployment process Don’t rebuild, reuse! Download application binaries from the Enterprise repository Externalize configuration as much as possible Patch if necessary with target environment configuration Deploy to target environment WAR WAR 1.0.1 1.0.1 Enterprise CI build Application Repository server Server Agile2009 - Making Agile Real 20
  • 21. Automated deployment Deployment strategies - direct reuse Reuse from the repository without modification Externalized environment-specific configuration JNDI Local environment-specific properties files ... WAR 1.0.1 Enterprise Application Repository Server Agile2009 - Making Agile Real 21
  • 22. Automated deployment Deployment strategies - patching Reuse binaries from the repository Modify internal configuration files for the target environment Can use overlays in Maven ectly! i es dir r binar p lo y you u ca n’t de o ly if y ing on Use patch N OTE: WAR 1.0.1 Enterprise Application Repository Server Agile2009 - Making Agile Real 22
  • 23. Automated deployment Patching - Deploying a web application in 5 easy steps! Create a deployment project Most of the directories are empty These are the files that will patch the web application for different environments Agile2009 - Making Agile Real 23
  • 24. Automated deployment Patching - Deploying a web application in 5 easy steps! <dependency> <groupId>myorg.myapp</groupId> Add a parameterized dependency <artifactId>myapp-web</artifactId> to your WAR <version>${webapp.version}</version> <type>war</type> </dependency> ... <properties> <webapp.version>${project.version}</webapp.version> </properties> Provide a sensible default target version Agile2009 - Making Agile Real 24
  • 25. Automated deployment Patching - Deploying a web application in 5 easy steps! <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> Incorporate the web application, but <warName>myapp-web</warName> exclude the files to be patched <overlays> <overlay> <groupId>myorg.myapp</groupId> <artifactId>myapp-web</artifactId> <excludes> <exclude>WEB-INF/classes/config.properties</exclude> </excludes> </overlay> ... Agile2009 - Making Agile Real 25
  • 26. Automated deployment Patching - Deploying a web application in 5 easy steps! <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> ... <webResources> <resource> <directory>${patch.path}</directory> </resource> </webResources> </configuration> </plugin> ... Include patched files in the final bundle Agile2009 - Making Agile Real 26
  • 27. Automated deployment Patching - Deploying a web application in 5 easy steps! <profile> The exact patch files is defined in profiles <id>dev</id> <properties> <patch.path>src/main/patches/dev</patch.path> </properties> </profile> For staging and production, you can also <profile> override the version being deployed <id>staging</id> <properties> <patch.path>src/main/patches/staging</patch.path> <webapp.version>${target.version}</webapp.version> </properties> Provide the version to be </profile> deployed as a parameter $ mvn package -Dtarget.version=1.0.5 -Pstaging The profile indicates the target environment Agile2009 - Making Agile Real 27
  • 28. Automated web deployment Automating the deployment process with Cargo Start, stop and install application servers Deploy to different application servers Run a stand-alone instance Or deploy to an existing server Deploy to different application servers WAR Run Cargo locally Agile2009 - Making Agile Real 28
  • 29. Automated web deployment Deploying to an embedded Jetty instance The simplest way to use Cargo with Maven <project> <build> ... Use the Cargo Maven plugin <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.0</version> </plugin> </plugins> </build> Start embedded Jetty instance $ mvn cargo:start ... [INFO] [cargo:start] [INFO] No container defined, using a default [jetty6x, embedded] container [INFO] [beddedLocalContainer] Jetty 6.x Embedded starting... ... 2009-07-21 16:47:36.470::INFO: Started SelectChannelConnector @ 0.0.0.0:8080 [INFO] [beddedLocalContainer] Jetty 6.x Embedded started on port [8080] [INFO] Press Ctrl-C to stop the container... Jetty is now running Agile2009 - Making Agile Real 29
  • 30. Automated web deployment Deploying to a “real” application server Deploy to a locally installed instance Download and install a server as required Deploy to a running server Start and stop a server ... WAR Agile2009 - Making Agile Real 30
  • 31. Automated web deployment Deploying to a local Tomcat server <project> <build> ... <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> Use a locally-installed Tomcat <version>1.0</version> installation <configuration> <container> <containerId>tomcat6x</containerId> <home>/usr/local/tomcat</home> Tomcat home directory goes here </container> <configuration> <type>standalone</type> <home>target/tomcat6x</home> </configuration> </configuration> </plugin> </plugins> </build> Agile2009 - Making Agile Real 31
  • 32. Automated web deployment Deploying to a local Tomcat server <project> <build> ... <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.0</version> <configuration> Or download a copy of Tomcat... <container> <containerId>tomcat6x</containerId> <zipUrlInstaller> <url>http://www.ibiblio.org/.../tomcat-6.0.20.zip</url> <installDir>${user.home}/tools/tomcat</installDir> </zipUrlInstaller> </container> <configuration> <type>standalone</type> ...and install it here <home>target/tomcat6x</home> </configuration> </configuration> </plugin> </plugins> </build> Agile2009 - Making Agile Real 32
  • 33. Automated web deployment Deploying to a remote server <project> <build> ... <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.0</version> Deploy to a remote server <configuration> <container> <containerId>tomcat6x</containerId> <type>remote</type> </container> <configuration> <type>runtime</type> <properties> <cargo.remote.username>admin</cargo.remote.username> <cargo.remote.password></cargo.remote.password> <cargo.tomcat.manager.url> http://appserver.acme.com:8888/manager </cargo.tomcat.manager.url> </properties> </configuration> Use these properties to connect </configuration> </plugin> to the server </plugins> </build> Agile2009 - Making Agile Real 33
  • 34. Automated web deployment Deploying a separate WAR file <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.0</version> Deploy a WAR file defined in the <configuration> dependency list <container>...</container> <configuration>...</configuration> <deployer> <deployables> The exact version of the WAR is <deployable> defined here <artifactId>ebank-web</artifactId> <groupId>org.ebank</groupId> <type>war</type> </deployable> </deployables> <dependencies> <dependency> </deployer> <groupId>org.ebank</groupId> </configuration> <artifactId>ebank-web</artifactId> </plugin> <type>war</type> ... <version>${target.version}</version> </dependency> </dependencies> <properties> <target.version>${project.version}</target.version> </properties> Agile2009 - Making Agile Real 34
  • 35. Automated web deployment Deploying a separate WAR file 1.0.1 WAR 1.0.1 maven WAR 1.0.1 Production server Agile2009 - Making Agile Real 35
  • 36. Automated web testing Automated functional/web tests Many tools available: Selenium HTMLUnit JWebUnit Canoo Webtest ... And many strategies: Run tests before deployment Run tests against the deployed application Agile2009 - Making Agile Real 36
  • 37. Automated web testing Basic principle - don’t rebuild, deploy! Create a special Maven project to run your web tests myapp mvn deploy myapp-core myapp-service WAR 1.0.1 myapp-web WAR myapp-webtest <dependency> Now run tests as usual Agile2009 - Making Agile Real 37
  • 38. Automated web testing Basic principle - don’t rebuild, deploy! Create a special Maven project to run your web tests myapp mvn deploy myapp-core myapp-service WAR 1.0.1 myapp-web WAR myapp-webtest Test server Or run tests against a test server Agile2009 - Making Agile Real 38
  • 39. Automated web testing Basic principle - don’t rebuild, deploy! Create a special Maven project to run your web tests myapp mvn deploy myapp-core myapp-service WAR 1.0.1 myapp-web WAR myapp-webtest Or deploy to and test a production server Production server Agile2009 - Making Agile Real 39
  • 40. Automated web testing Testing Snapshots or Release Candidates - an approach Use a dedicated release candidate branch Changes are merged into the release candidate branches when ready Automated tests are (also) run against the release candidate branch Releases are run against the release candidate branch Updated version numbers need to be merged back to the trunk development trunk release candidate branch mvn release Agile2009 - Making Agile Real 40
  • 41. Automated web testing Testing Snapshots or Release Candidates - an approach Use multiple repositories on your Enterprise server release candidate branch Deploy to Release snapshots myapp Candidate repository releases myapp-core release candidates myapp-service WAR 1.0.1-SNAPSHOT myapp-web WAR myapp-webtest <dependency> Now run tests as usual Agile2009 - Making Agile Real 41
  • 42. Deploying Database Updates But what about database updates? Schema updates Data updates Data migration Database backups and updates Rollbacks Agile2009 - Making Agile Real 42
  • 43. Deploying Database Updates Several approaches and tools exist, e.g. Manual SQL scripts Hibernate Liquibase ... Agile2009 - Making Agile Real 43
  • 44. Deploying Database Updates Liquibase - smart database updates Open source tool for managing database changes Database changes are stored in XML form in the SCM Database neutral Many powerful features Roll back changes Merge changes from several developers Generate a SQL update script that a DBA can apply ... Agile2009 - Making Agile Real 44
  • 45. Deploying Database Updates Liquibase change sets Database changes recorded manually in XML More work, but allows more intelligent rollbacks <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.6 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.6.xsd"> Each changeset is unique <changeSet id="1" author="john"> <createTable tableName="department"> Create a new table <column name="id" type="int"> <constraints primaryKey="true" nullable="false"/> </column> <column name="name" type="varchar(50)"> <constraints nullable="false"/> </column> <column name="active" type="boolean" defaultValue="1"/> </createTable> </changeSet> </databaseChangeLog> Agile2009 - Making Agile Real 45
  • 46. Deploying Database Updates Liquibase change sets Lots of types of changes are supported DDL updates (add, modify or drop tables, columns or indexes...) <databaseChangeLog...> Add a new column <changeSet id="2" author="simon"> <addColumn tableName="department"> <column name="description" type="varchar(50)"/> </addColumn> <dropColumn tableName="department" columnName="telex" > </changeSet> </databaseChangeLog> Drop a column Agile2009 - Making Agile Real 46
  • 47. Deploying Database Updates Liquibase change sets Lots of types of changes are supported DDL updates (add, modify or drop tables, columns or indexes...) Insert data... <databaseChangeLog...> Insert a row of data <changeSet id="4" author="john"> <insert tableName="country"> <column name="id" valueNumeric="1"/> <column name="code" value="AL"/> <column name="name" value="Albania"/> </addColumn> </changeSet> </databaseChangeLog> <databaseChangeLog...> <changeSet id="3" author="simon"> <loadData tableName="countries" file="countries.csv"> <column name="id" type="NUMERIC"/> <column name="code" type="STRING"/> Upload data from a file <column name="name" type="STRING"/> </loadData> </changeSet> </databaseChangeLog> Agile2009 - Making Agile Real 47
  • 48. Deploying Database Updates Integration with Maven <project> <build> <plugins> Use the Maven Liquibase plugin <plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-plugin</artifactId> <version>1.9.3.0</version> <configuration> <propertyFileWillOverride>true</propertyFileWillOverride> <propertyFile>src/main/resources/liquibase.properties</propertyFile> </configuration> </plugin> </plugins> </build> ... changeLogFile = changelog.xml </project> driver = com.mysql.jdbc.Driver url = jdbc:mysql://localhost/ebank username = scott password = tiger verbose = true And a configuration file dropFirst = false liquibase.properties Agile2009 - Making Agile Real 48
  • 49. Deploying Database Updates Integration with Maven Commands can be run directly or as part of the lifecycle, e.g. Update any unimplemented changes $ mvn liquibase:update $ mvn liquibase:rollback -Dliquibase.rollbackCount=1 Rollback latest changes mvn liquibase:updateSQL Generate SQL update script Agile2009 - Making Agile Real 49
  • 50. Scripting the deployment process Real-world deployments are complex Deployments to application servers Database backups and updates Web service deployments ... Some tasks need to be manual... ...but many don’t Agile2009 - Making Agile Real 50
  • 51. Scripting the deployment process Deployment scripting - Groovy is your friend! Close to Java Concise and readable Great for file manipulation How can you use Groovy? Use a dedicated Maven project to fetch and/or prepare the artifact Call the Groovy script from your Maven deployment project Or wrap the Maven script in Groovy and add the more specific tasks Agile2009 - Making Agile Real 51
  • 52. Scripting the deployment process Using Groovy Scripting in Maven Just use the GMaven plugin Embed Groovy script in your pom.xml file Run an external Groovy script Use elements of your pom.xml or settings.xml in your script Agile2009 - Making Agile Real 52
  • 53. Scripting the deployment process Using Groovy Scripting in Maven Just use the GMaven plugin <build> <plugins> <plugin> <groupId>org.codehaus.groovy.maven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.0-rc-5</version> Run some Groovy code <configuration> <source> println "Hi there, I’m ${user.name}. My project is ${project.name}" </source> </configuration> </plugin> </plugins> You can use objects from your pom.xml file </build> Agile2009 - Making Agile Real 53
  • 54. Scripting the deployment process Using Groovy Scripting in Maven Another example - invoking another Groovy script <settings...> <build> <servers> <server> <plugins> <id>dbserver</id> <plugin> <username>scott</username> <password>tiger</password> <groupId>org.codehaus.groovy.maven</groupId> </server> </servers> <artifactId>gmaven-plugin</artifactId> ... <version>1.0-rc-5</version> </settings> settings.xml <configuration> <source> Fetch username and password details from the settings.xml file def server = settings.servers.find{ it.id.equals('dbserver') } """groovy update-scripts.groovy -Ddb.username=${server.username} -Ddb.password=${server.password}""".execute() </source> </configuration> </plugin> Invoke an external Groovy script and provide the </plugins> username and password as parameters </build> Agile2009 - Making Agile Real 54
  • 55. An example: JIRA and Bamboo Automating the release process with JIRA and Bamboo Issues, releases, and Automated builds version numbers and deployments List of available versions 1.0.0 1.0.1 1.0.2 1.0.2 maven WAR 1.0.2 App Server Agile2009 - Making Agile Real 55
  • 56. Example: JIRA and Bamboo Automating the release process with JIRA and Bamboo Agile2009 - Making Agile Real 56
  • 57. Example: JIRA and Bamboo Automating the release process with JIRA and Bamboo Agile2009 - Making Agile Real 57
  • 58. And in Hudson? Use the “parameterized build” plugin Add parameters to your build job Agile2009 - Making Agile Real 58
  • 59. And in Hudson? Use the “parameterized build” plugin Hudson prompts you for the parameter when you run the build Agile2009 - Making Agile Real 59
  • 60. In conclusion What have we covered? Using the Maven Release Cycle Nexus as a cornerstone of the deployment process Cargo to automate your application deployment Liquibase to manage your database updates Using Groovy in your Maven builds Agile2009 - Making Agile Real 60
  • 61. John Ferguson Smart Email: john.smart@wakaleo.com Web: http://www.wakaleo.com Twitter: wakaleo Thanks for your attention Agile2009 - Making Agile Real 61