How to Deploy to CloudBees, in One Click

When I deploy a new version of stateful.co,
a Java web application, to CloudBees, it takes 30 seconds of my time.
Maybe even less. Recently, I deployed version 1.6.5. You can see
how it all happened, in GitHub issue #6:

As you see, I gave a command to Rultor,
and it packaged, tested and deployed a new version to CloudBees.
I didn’t do anything else.

Now let’s see how you can do the same. How you can configure your project
so that the deployment of its new version to CloudBees
takes just a few seconds of your time.

This plugin is not in Maven Central (unfortunately). That’s why
we have to specify that <pluginRepository>.

Pay attention to the fact that we’re also disabling maven-deploy-plugin, since
it would try to deploy your WAR package to the repository from the
<distributionManagement> section. We want to avoid this.

The profile gets activated only when the bees.id property
is defined. This won’t happen during your normal development and testing,
but it will occur during the deployment cycle initiated by Rultor, because
we will define this property in settings.xml (discussed below).

Secure Access to CloudBees

Create an account in CloudBees and register your web application there.
CloudBees is free, as long as you don’t need too much computing power. I believe
that web applications should be light-weight by definition, so CloudBees’ free
layer is an ideal choice.

You should get a settings.xml.asc file; add it to the root directory
of your project, commit and push. This file contains your CloudBees
credentials, but in an encrypted format. Nobody can read it, except the
Rultor server.

Configure Versions Plugin

I recommend using jcabi-parent.
It configures the required plugin out-of-the-box.
If you’re using it, skip this step.