The deploy
task supports deployment of one or more applications to the Liberty server.
deploy
depends on libertyStart
for a running server.
See the Liberty server configuration properties for common server configuration.
The deploy
task uses a deploy
block inside the liberty
block to define task specific behavior.
Attribute | Type | Since | Description | Required |
---|---|---|---|---|
file | String | 1.0 | Location of a single application to be deployed. The application type can be war, ear, rar, eba, zip, or jar. | Yes, only when a single file will be deployed. |
dir | String | 1.0 | Location of the directory where are the applications to be deployed. | Yes, only when multiples files will be deployed and file is not specified. |
include | String | 1.0 | Comma or space-separated list of patterns of files that must be included. All files are included when this attribute is omitted. | No |
exclude | String | 1.0 | Comma or space-separated list of patterns of files that must be excluded. No files are excluded when this attribute is omitted. | No |
- Deploys a single file.
apply plugin: 'liberty'
liberty {
installDir = 'c:/wlp'
server {
name = 'myServer'
deploy {
file = 'c:/files/app.war'
}
}
}
- Deploy multiple files. Specifically, deploy
app.war
andsample.war
but excludetest-war.war
.
apply plugin: 'liberty'
liberty {
server {
name = 'myServer'
deploy {
dir = 'c:/files'
include = 'app.war, sample.war'
exclude = 'test-war.war'
}
}
}
- Deploy multiple files using multiple blocks.
apply plugin: 'liberty'
liberty {
installDir = 'c:/wlp'
server {
name = 'myServer'
deploy {
file = 'c:/files/app.war'
}
deploy {
file = 'c:/resources/test.war'
}
deploy {
dir = 'c:/extras'
include = 'sample.war, demo.war'
}
}
}
The following examples shows you how to deploy a file using the WAR
or the EAR
Gradle plugins:
/* Deploys 'sample.war' using the WAR plugin */
apply plugin: 'war'
war {
destinationDir = new File ('C:/files')
archiveName = 'sample.war'
}
destinationDir
and archiveName
are native properties of Gradle's WAR plugin. For more information see here.
/* Deploys 'test.ear' using the EAR plugin */
apply plugin: 'ear'
ear {
destinationDir = new File ('C:/files')
archiveName = 'test.ear'
}
destinationDir
and archiveName
are native properties of Gradle's EAR plugin. For more information see here.