03 July 2012

Tags: cloudfoundry gradle

gradle-cf-plugin upgraded to 0.2

I have just published a new version of the Gradle plugin for CloudFoundry. The main change is that it supports standalone applications, meaning you will be able to push your applications to CloudFoundry all from Gradle.

To deploy a standalone application, you can do the following:

buildscript {
       repositories {
         mavenCentral()
       }
       dependencies {
           classpath group: 'org.gradle.api.plugins', name: 'gradle-cf-plugin', version: '0.2.0'
       }
   }

   apply plugin: 'cloudfoundry'

Then add to your build.gradle file a section describing your deployment settings (note the standalone framework):

cloudfoundry {
   target='https://api.vcap.me'
   username = 'user-AT-domain-DOT-com'
   password='foobar'
   application = 'myapp'
   framework = 'standalone'
   applicationFramework='standalone'
   runtime = 'java'
   command = "$name/bin/$name"
   file = distZip.archivePath
   uris = ['https://myurl.vcap.me']
   memory = 256
}

If you migrate your application from version 0.1.0 to 0.2.0 of the plugin, then you have to change the warFile property to file. Now, you are able to push your application to CloudFoundry using the cf-push task:

gradle cf-push

Note that in future versions of the plugin, we will likely change the name of the tasks so that they follow the Gradle conventions (using, for example, cfPush instead of cf-push).