This plugin uses the common plugin keywords as well as those for “sources”. For more information, see Snapcraft parts metadata.
Additionally, this plugin uses the following plugin-specific keywords
gradle-options (list of strings)
flags to pass to the build using the gradle semantics for parameters.
The ‘jar’ option is automatically passed and will be passed in as the last parameter.
Essentially you can include any gradle command line options such as ‘-x test’ ‘–debug’ as a comma separated list.
gradle-options: [-xtest, --debug]
Note: your options must not contain spaces!
gradle-output-dir (string; default: ‘build/libs’)
Informs snapcraft where your build.gradle will place the generated files.
The output directory where the resulting jar or war files from gradle[w]
You should normally NOT include this option unless your build.gradle is placing the output files in an unusual place.
The version of gradle you want to use to build the source artifacts.
Defaults to the current release downloadable from
The entry is ignored if gradlew is found.
The checksum for gradle-version in the form of /.
As an example “sha512/2a803f578f341e164f6753e410413d16ab60fab…”.
openjdk version available to the base to use. If not set the latest
version available to the base will be used.
The gradle plugin currently always runs the jar task rather than the build task. The result is that even if your build.gradle is configured to build a war you will actually end up with a jar. To fix this problem include a gradle-option keyword with the ‘war’ task.
gradle-options: [-xtest, war]
The jar file will still be generated but so will your war file.
gradlew vs gradle
When the gradle plugin runs it will search for ‘gradlew’ in the directory you run snapcraft from. If it finds gradlew then it will run the build using gradlew. If gradlew doesn’t exist then it will fall back to using gradle.
Using gradlew is recommended.
If you are looking to run the latest version of gradle then make certain that gradlew is present.
The gradle plugin will automatically go looking for environment variables that contain proxy settings.
The environment variable names that it looks for are:
If found these variables will be passed as options to gradle.
gradle-options: [-xtest, war] # suppress running of tests and run the war task