FIrst thing you need to do, in order to use the plugin, is to add it to your buildfile. Because this plugin is not in the list of standard gradle plugins, you need to pass a closure to the buildscript method. Everything that you add there will be executed before your actual buildscript is invoked. So in essence you can add some set-up information there, which is exactly what we want. Let's look at what should be added to the build.gradle file:
buildscript {
repositories {
mavenRepo urls: 'file:///tmp/'
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
name = "GitHub"
addArtifactPattern 'http://github.com/hierynomus/appengine-gradle-plugin/downloads/[organization]-[module]-[revision].[ext]'
}
}
dependencies {
classpath 'com.xebia:appengine-gradle-plugin:0.2@jar'
classpath 'appengine:tools-api:1.3.2@jar'
}
}
Now we can add the plugin to our gradle buildfile:
buildscript { ... }
defaultTasks 'build'
usePlugin 'war'
usePlugin com.xebia.gradle.plugins.AppEngine
You are now almost ready to use the plugin. One thing left to do is add a properties file to the root of your build directory. In this property file we will denote the location of the Google AppEngine SDK, which is needed by the AppEngine Tools which are used under the hood.
appEngineSdkRoot=<path to appengine sdk>
Once you're done, and your application is setup to the AppEngine guidelines, it is just a matter of running the following command:
$ gradle upload
After that you can see in your AppEngine dashboard that the plugin uploaded a new version of your application
No comments:
Post a Comment