IBM Bluemix - Building a Project with Maven

Post on 25-Jul-2015

159 views 2 download

Tags:

Transcript of IBM Bluemix - Building a Project with Maven

Building on Bluemixwith Maven

craigtrim@gmail.com

This is not an official IBM position. The views expressed are solely my own.

How it worksMaven

• A build automation tool primarily for Java projects• http://trimc-devops.blogspot.com/p/masterpage.html#maven

Jenkins

• An open source continuous integration tool written in Java. • http://trimc-devops.blogspot.com/p/masterpage.html#jenkins

Docker

• A container technology for packaging and deploying distributed applications• http://trimc-devops.blogspot.com/p/masterpage.html#docker

How it works

• Maven uses POM (Project Object Model) files to specify the build and deployment procedures for Java projects.• Jenkins is able to plugin into a variety of SCM tools (including Git) and build

a Java project using a tool like Maven.• Each time a change in checked into Git, Jenkins can be configured to automatically

build the project(s) using Maven and show the result on a dashboard.• Integration is Continuous and any issues, including build errors, are immediately

brought to the forefront

• Docker is used to dynamically provision a transient Jenkins slave, run the build, and then tear down that slave• This is a common paradigm and described here:

https://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin

How it works (Issues)

• The use of Docker to dynamically provision Jenkins, run a build,a nd then tear down the slave means the Maven repository is transient• It is not possible to share a Maven repository between builds• This is a design flaw and has a real impact on how code is structured and

deployed• The only way I can think of to overcome this is to have a Maven repository

outside of JazzHub to publish artifacts to.

Step 1: Locate your project

Step 2: Click “Build and Deploy”

Step 3: Enable “Make this a Bluemix Project”

Step 4: Specify the Bluemix space

Step 5: Click “+ ADD STAGE”

Step 6: Verify the Input tab

Step 7: Click “ADD JOB”

Step 8: Select a “Build” job

Step 9: Select Maven from the drop-down list

Step 10: Shell Scripting

In each repository I have a build/pom.xml file that controls the build for those projects. I navigate to the “build” sub-dir and run the maven install command (executes the entire maven lifecycle)

Step 11: Click the Run (arrow) button

Step 12: The Stage is running …

Step 13: View the output

This particular build took a while to get right …