The Deployment Helper Gradle plugin lets you run the Liferay Deployment Helper tool to create a cluster deployable WAR from your OSGi artifacts.
The plugin has been successfully tested with Gradle 4.10.2.
Usage
To use the plugin, include it in your build script:
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.deployment.helper", version: "1.0.5"
}
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "com.liferay.deployment.helper"
Since the plugin automatically resolves the Liferay Deployment Helper library as a dependency, you have to configure a repository that hosts the library and its transitive dependencies. The Liferay CDN repository hosts them all:
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
Tasks
The plugin adds one task to your project:
Name | Depends On | Type | Description |
---|---|---|---|
buildDeploymentHelper | - | BuildDeploymentHelperTask | Builds a WAR which contains one or more files that are copied once the WAR is deployed. |
BuildDeploymentHelperTask
Tasks of type BuildDeploymentHelperTask
extend JavaExec
,
so all its properties and methods, such as args
and maxHeapSize
,
are available. They also have the following properties set by default:
Property Name | Default Value |
---|---|
args | The Deployment Helper command line arguments. |
classpath | project.configurations.deploymentHelper |
deploymentFiles | The output files of the jar tasks of this project and all its sub-projects. |
main | "com.liferay.deployment.helper.DeploymentHelper" |
outputFile | "${project.buildDir}/${project.name}.war" |
Task Properties
The properties of type File
support any type that can be resolved by
project.file
.
Task Methods
Method | Description |
---|---|
BuildDeploymentHelperTask deploymentFiles(Iterable<?> deploymentFiles) | Adds files or directories to include in the WAR and copy once the WAR is deployed. The values are evaluated as per project.files . |
BuildDeploymentHelperTask deploymentFiles(Object... deploymentFiles) | Adds files or directories to include in the WAR and copy once the WAR is deployed. The values are evaluated as per project.files . |
Additional Configuration
There are additional configurations that can help you use the Deployment Helper.
Liferay Deployment Helper Dependency
By default, the plugin creates a configuration called deploymentHelper
and
adds a dependency to the latest released version of the Liferay Deployment
Helper. It is possible to override this setting and use a specific version of
the tool by manually adding a dependency to the deploymentHelper
configuration:
dependencies {
deploymentHelper group: "com.liferay", name: "com.liferay.deployment.helper", version: "1.0.4"
}