Cloud Foundry Maven Plugin to build and deploy Bluemix Applications

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.