Getting Started with Bluemix and Bluemix DevOps Services using Java

Last modified: 24 March 2015

Time: 30 minutes

Learning objectives

  • Create an app in IBM® Bluemix™ by using the Liberty for Java starter pack.
  • Create a Git repository for the app.
  • Add the IBM Continuous Delivery Pipeline for Bluemix (the Delivery Pipeline service).
  • Push changes to the Git repository from the command line or the IBM® Bluemix™ DevOps Services Web IDE.
  • Build and deploy your changes by using the Delivery Pipeline service.

Create an app with IBM Bluemix

IBM® Bluemix™ is an open-standard, cloud-based platform for building, managing and running apps of all types, including web, mobile, big data, smart devices. The Bluemix capabilities include Java™, mobile back-end development, app monitoring, and capabilities from ecosystem partners and open source, all through an as-a-service model in the cloud.

If you aren't registered, sign up for free on the Bluemix home page. After you register, learn more about Bluemix at IBM Bluemix Docs.

If you prefer to try things rather than read about them, try this tutorial. You can set up and run a sample app in minutes.

Sign in to Bluemix to start working!

Bluemix Dashboard

The dashboard shows an overview of the active Bluemix space for your organization. By default, the space is dev and the organization is the project creator's user name. For example, if signs in to Bluemix for the first time, the active space is dev and the organization is

If you create other organizations or spaces in Bluemix, be sure to use the default selections as you follow the tutorial.

Click the CREATE AN APP tile, then select WEB for the type of app you are creating. On the next page, select Liberty for Java to start with, and then click CONTINUE:

Bluemix Java Web Starter

Type a name for your app, such as Liberty for Java Starter app tutorial with your initials to make it unique, and click Finish.

Naming a Bluemix app

In a few moments, you'll have a Java web server app instance running on Bluemix. Click Overview to view information about your app:

The new app's Bluemix dashboard

If you click the route on the app dashboard, you can access the running Starter app:

A running web application

Although it's great that the app is running, you will want to modify it to make it more interesting.

You can work with your app code in many ways. For example, with auto-deploy, you can modify the code that runs in your app by pushing the changes to a Git repository. The mechanism that implements auto-deploy is provided by Bluemix™ DevOps Services, but more about that later.

On your app’s Overview page, click ADD GIT.

Add Git

You might be prompted to enter your password because DevOps Services must verify that it can act on your behalf.

Note: The first time that you access IBM DevOps Services, you must create an alias that is linked to your IBM id. An alias is a unique, publicly visible short name that is used in Git repository paths, Track & Plan, and desktop and command line clients, including the URL for the repository that is created for you. For this one-time process, follow the instructions in the window.

Make sure you check the option Populate the repository with the starter application package and enable build and deploy. Click CONTINUE, then CLOSE.

Create Git repo dialog

A message displays that you successfully created a Git repo and loaded it with the app starter code.

Before you start editing your code in DevOps Services, enable the IBM Continuous Delivery Pipeline for Bluemix (the Delivery Pipeline service) so that you can use several of the build and deployment capabilities later.

  1. On the app’s Overview page, click ADD A SERVICE OR API.
  2. Select the DevOps category, then click Delivery Pipeline.
  3. Use the default settings for Space and the Selected plan.
  4. Click CREATE.

The Delivery Pipeline service is added to your Bluemix space. It will be ready when you need it later.

Next, start using DevOps Services. Click EDIT CODE.

CODE button

Your project opens in the DevOps Services Web IDE (integrated development environment). When you clicked Add Git in Bluemix, you populated a new Git repository with sample code. When you clicked EDIT CODE, that code is loaded into a work area associated with the project, called the project workspace.

Push changes to the Git repository

You can push changes to the Git repository either by the Web IDE or the command line.

Edit files and deploy changes by using the DevOps Services Web IDE

DevOps Services provides many capabilities that are useful for app development:

  • Hosting for public projects
  • Multiple source code repositories
  • Support for teams that use agile development
  • Web-based development tools with customizations specifically for working with Bluemix

To learn more about DevOps Services, see its Learn page.

You can work with DevOps Services entirely in your browser, if you want. By clicking EDIT CODE, you opened a complete online integrated development environment (IDE), which is based on the work of the Orion open source project.

Orion at Bluemix DevOps Services

In this environment, you can edit files with syntax coloring support for multiple programming languages, including HTML, CSS, Java, JavaScript, Ruby, and Python. For some languages, such as JavaScript and CSS, the IDE also supports syntax checking and content assist, both for standard language constructs and for services that Bluemix provides. To use content assist, press Ctrl + Space. For example, this image shows code completion for the standard Node.js express module:

Orion showing express completions

Tip: While you are outside of the code editor, you can search through the various key bindings in the IDE by pressing Shift + ?. To search while you’re in the editor, press Shift + Alt + ?.

Navigate through the directory tree and find the WebContent/index.html file.

Click the file name to edit it.

Orion editing index

Save your changes. Click the Git Repository icon, then push the change by using the integrated Git support.

In the Working Directory pane, stage the change by selecting the files you want to commit to the master branch.

Type a description of the change and click Commit.

Orion git commit

Push the change from the local 'master' branch to the remote branch.

Orion git push

Refresh your browser to ensure that the updated page is shown.

Application page showing new message

Push changes to the Git repository by using the command line

You now have a Git repo with sample code. You can use many tools to work with Git, including all of the major desktop IDEs and the DevOps Services Web IDE. You can also use the command-line Git support.

Note: If you don't have Git installed, see Setting up Eclipse, Git, and Rational Team Concert Desktop Clients for use with DevOps Service. If you want to learn more about working with Git, see the Git documentation pages.

Clone from the project repository URL, which you can find on the Bluemix app's dashboard or the DevOps project's Overview:

$ git clone
Cloning into ''...
Username for '': <username>
Password for 'https://<username>': <password>
remote: Counting objects: 49, done
remote: Finding sources: 100% (49/49)
remote: Total 49 (delta 0), reused 49 (delta 0)
Unpacking objects: 100% (49/49), done.
Checking connectivity... done. 

To make changes to your app source code, open the root directory for the app, the WebContent folder, then the file index.html. Change some text in the body of the HTML. When you're done, change to your project directory and git stage, git commit, and git push:

$ cd /project_directory
$ git stage Webcontent/index.html
$ git commit -m "Sample app headline change"
[master 2336018] Sample app headline change
1 file changed, 1 insertion(+), 1 deletion(-)

$ git push
Username for '': <username>
Password for 'https://<username>':
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 382 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: refs: 1, done
    ab4aaad..2336018 master -> master

In DevOps Services, click BUILD & DEPLOY. A new build was requested. It was automatically triggered by the changes that you delivered to the project repository. When the build is finished, it is deployed to Bluemix. When the instance is running, you can view your updated app on the web.

You can continue to modify the example and push your changes to the Git repository as often as needed. As the scope of the work grows and more people are added to the project, everyone can push changes to the repository. Standard repository operations and build and deploy are all that is required to ensure that the right bits are always running.

If you want to configure desktop clients to work with your Git repository, see Setting up Eclipse, Git, and Rational Team Concert Desktop Clients for use with DevOps Service.

Build and deploy by using DevOps Services

In the BUILD & DEPLOY page, run your build by clicking the Play icon in the Build stage tile.

Play button

The build stage begins running. The deploy stage is configured to auto-deploy your app after a successful build. When the app is running, it is available at the URL shown on the Deploy stage tile. You can see the app's Overview page on Bluemix by clicking the tile under LAST EXECUTION RESULT, where the app name is shown.

Bluemix DevOps Services autoconfigured Pipeline

Your sample project is configured to automatically build and deploy the Liberty for Java sample app, but you can make changes to the configuration or delete it to set it up from scratch.

A preconfigured Pipeline

To see how to set up the Build & Deploy feature, also known as Pipeline, undo the configuration:

  1. On the Deploy Stage tile, click the gear icon. Click Delete Stage and confirm the deletion.
  2. On the Build Stage tile, click the gear icon. Click Delete Stage and confirm the deletion.

Within the Build & Deploy stages, you can configure jobs to compile and package your app, deploy the app to Bluemix, and run tests on your code. In this tutorial, you create a Build stage, which contains a build job, and a Deploy stage, which contains a deploy job.

Unconfigured Advanced Build & Deploy page

Configure the build stage:

  1. Click ADD STAGE. The Stage Configuration page opens.
  2. Click the stage name, MyStage. Type Build as the new name.
  3. Make sure that the Automatically execute jobs when a change is pushed to Git option is selected. The stage is configured to accept input from the master branch of your project's Git repository.
  4. Click JOBS. Click ADD JOB and then select Build.
  5. For the builder type, select Ant. Use the default settings for everything else. The ant command will find the default build script file, build.xml, which is provided in the sample at the root directory. The files that are needed for deployment are copied into the build archive directory.
  6. Click SAVE.

Configuring the Builder

After a moment, the Pipeline page is refreshed and shows the information about your newly configured stage. At the top of the Build stage tile, click the Play icon. After a moment, you have a successful build.

A configured Builder panel with a successful build

Create another stage so that you can deploy your build to Bluemix:

  1. Click ADD STAGE. The Stage Configuration page opens.
  2. Click the stage name, MyStage. Type Deploy as the new name.
  3. Make sure that the Automatically execute jobs when the previous stage completes successfully option is selected. The stage is already configured to accept the build job output from the Build stage that precedes it.
  4. Click JOBS. Click ADD JOB and then select Deploy to dev.
  5. Use the default settings on the Deploy Configuration page.
  6. If necessary, update the Space field to your Bluemix organization's dev space.
  7. Click SAVE.

Configuring the Deployer with the Add Deployer Stage screen

After a moment, the Pipeline page is refreshed and shows the information about your newly configured stage.

Because you selected the Automatically execute jobs when the previous stage completes successfully option when you set up the deploy stage, successful builds of your app are deployed automatically. If you did not have this option selected, you could start a deployment by dragging a build to a stage with a deploy job. In the LAST EXECUTION RESULT section of the Build tile, drag the build to the Deploy stage, as shown below. You could also click the Play button in the Deploy stage to start the deployment. In a few moments, your app is deployed to Bluemix.

Dropping to deploy

To view your app on the web, in the Deploy stage, click the URL under the LAST EXECUTION RESULT heading. If you already had the app open in a browser window, refresh the page. To view your app’s Bluemix dashboard, click its the tile where the app name is displayed.

Our really cool app

In this tutorial, you configured a single stage for deployment. You might want more stages; for example, so that you can have separate instances for testing and production. If so, create more stages that contain the jobs that you want to run.

When you build and deploy apps by using Bluemix, your Bluemix billing account might be charged. A project is granted 60 minutes of free build time per month. For more information about pricing for any service, see the Bluemix Pricing page.


In this tutorial, you learned to easily create a Java web app on Bluemix and run that app. With a few clicks, you created a Git repo, loaded it with the sample code, and automatically deployed the app. You changed code and pushed it DevOps Services Web IDE, and then by using the Git command line. You configured automatic building and deployment, checked the status of the app deployment, and ran the app to verify your changes.

You learned how to get started with Java in Bluemix and DevOps Services. Lots of details were minimized, but you can find out more from the documentation links at the beginning of the tutorial.

Next steps

To learn more about configuring Eclipse or other desktop clients to work with your Git repository, see Setting up Eclipse, Git, and Rational Team Concert Desktop Clients for use with DevOps Service.

To learn about how to integrate unit testing into your DevOps Services projects, see Developing Bluemix apps in Java with Eclipse and Bluemix DevOps Services.

Need help? Ask a question in the IBM Bluemix DevOps Services forum. Have feedback? Report a bug or share your idea in the IBM Bluemix DevOps Services project.

© Copyright IBM Corporation 2013, 2015.