Over a million developers have joined DZone.

Cloud Foundry Maven Plugin to Build and Deploy Bluemix Applications

DZone's Guide to

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
Free Resource

Are you joining the containers revolution? Start leveraging container management using Platform9's ultimate guide to Kubernetes deployment.

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.

Using Containers? Read our Kubernetes Comparison eBook to learn the positives and negatives of Kubernetes, Mesos, Docker Swarm and EC2 Container 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.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}