Over a million developers have joined DZone.

Cloud Foundry Maven Plugin to Build and Deploy Bluemix Applications

Learn more about the Cloud Foundry Maven Plugin, and how it can make it deployment easier by leveraging user-provided services, setting environmental variables, and more.

· Cloud Zone

Download the Essential Cloud Buyer’s Guide to learn important factors to consider before selecting a provider as well as buying criteria to help you make the best decision for your infrastructure needs, brought to you in partnership with Internap.

For some people this is old news, but I just used for the first time the Cloud Foundry Maven Plugin to build and deploy a Bluemix application and it made the deployment really easy. Below are some of the key concepts I used.

I built a Java application that leverages the AlchemyAPI service which at this point requires to go to a separate website and register an API key which is then stored in a user provided service. Additionally I used web sockets and I had to set an environment variable to use this feature on Liberty for Java.

With the Cloud Foundry Maven Plugin I can create user provided services, normal services, set environment variables and much more. The pom.xml screenshot below shows the configuration of the plugin. To use the plugin you simply add it to your pom.xml.

In order to invoke the build and deployment task you can execute the following command and pass in input parameters.

For the actual deployment to Bluemix the plugin requires your Bluemix credentials which are stored in a Settings.xml file in ~/.m2.

Update July 17th: You should use a profile as documented by Ryan below. Here is a sample.

The Cloud Zone is brought to you in partnership with Internap. Read Bare-Metal Cloud 101 to learn about bare-metal cloud and how it has emerged as a way to complement virtualized services.

maven,cloud foundry,bluemix,cloud

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}