This plugin has been superceded by https://github.com/cloudfoundry/cf-java-client/tree/master/cloudfoundry-gradle-plugin
This plugin allows you to deploy, update, remove applications thanks to Gradle tasks. It is intended to replace the use of vmc to deploy such applications.
The plugin adds the following tasks:
Configuration is either project based or task based. It is simpler to use project configuration. Here is a sample Gradle project.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.gradle.api.plugins', name: 'gradle-cf-plugin', version: '0.1.0-SNAPSHOT'
}
}
apply plugin: 'cloudfoundry'
cloudfoundry {
username = '[email protected]'
password = 's3cr3t'
application = 'appName'
framework = 'grails'
file = new File('/path/to/app.war')
uris = ['http://appName.cloudfoundry.com']
}
Then usage is simple:
This will deploy the application:
gradle cf-push
The configuration options are:
Adding a service makes use of another configuration section:
cloudfoundryService {
serviceName = 'service1'
vendor = 'mongodb'
version = '1.8'
}
The cloudfoundryService
section accepts several parameters:
Removing a service makes use of the same cloudfoundryService
section, and uses the serviceName
option. If
the value of the service name is *
, then all services are removed.
In addition to the build.gradle based configuration, it is also possible to use command line options to set properties. For example, to create a new service, you can use the following command line (assuming you set the cloudfoundry section in the build.gradle file):
gradle cf-add-service -PcloudfoundryService.serviceName='mongodb-1' -PcloudfoundryService.vendor='mongodb'
CloudFoundry has support for standalone applications. In that case, you must configure the following options:
For example:
cloudfoundry {
target='http://api.vcap.me'
username = '[email protected]'
password='foobar'
application = 'myapp'
framework = 'standalone'
applicationFramework='standalone'
runtime = 'java'
command = "$name/bin/$name"
file = distZip.archivePath
uris = ['http://myurl.vcap.me']
memory = 256
}
Future work includes ability to add users and support other features of Cloud Foundry. Any help is appreciated.