Gradle plugin¶
The Gradle plugin builds Java projects using the Gradle build tool.
After a successful build, this plugin will:
Create
bin/
andjar/
directories in$CRAFT_PART_INSTALL
.Find the
java
executable provided by the part and link it as$CRAFT_PART_INSTALL/bin/java
.Hard link the
.jar
files generated in$CRAFT_PART_BUILD
to$CRAFT_PART_INSTALL/jar
.
Keywords¶
In addition to the common plugin and sources keywords, this plugin provides the following plugin-specific keywords:
gradle-init-script¶
Type: string
The path to the initialization script to run with gradle --init-script <gradle-init-script>
command. See official gradle documentation
on the init script.
gradle-parameters¶
Type: list of strings
Used to add additional parameters to the gradle <task>
command line.
gradle-task¶
Type: string
The Gradle task to build the project.
Environment variables¶
Environment variables can be specified to modify the behavior of the build. For the Gradle plugin,
three proxy environment variables are treated specially: http_proxy
, https_proxy
and
no_proxy
. For a list of environment variables used to configure Gradle, please refer to
Configuring the build environment.
http_proxy¶
URL to proxy HTTP requests to. The value is mapped to the settings file (.parts/.m2/settings.xml) under proxy element.
https_proxy¶
URL to proxy HTTPS requests to. The value is mapped to the settings file (.parts/.m2/settings.xml) under proxy element.
no_proxy¶
A comma-separated list of hosts that should be not accessed via proxy.
Example¶
Here is a consolidated example of how to use the Gradle plugin.
plugin: gradle
source: .
gradle-init-script: <path-to-gradle-init-script>
gradle-parameters:
- -D<some-parameter>=<some-value>
gradle-task: build
build-environment:
- http_proxy: <http-proxy-url>
- https_proxy: <https-proxy-url>
- no_proxy: <comma-separated-no-proxy-urls>
For possible values of each field, refer to the Gradle documentation.
gradle-parameters
: Command line interfacegradle-task
: Understanding tasksbuild-environment
: Configuring the build environment