Liberty: Ant task - server
The server task can be used to manage the status of a Liberty server.
Description
The server task supports the following options to manage the status of a Liberty server:
- create, which creates a named server instance.
- start, which starts the named server instance. If the server instance does not exist, this option creates one by default.
- stop, which stops the named server.
- status, which checks the server status.
- package, which packages the named server and its deployed applications.
Attributes
The following table describes attributes of the server task.
Attribute | Description | Required |
---|---|---|
installDir | Location of the Liberty server. | Yes |
operation | Server operations available as options: create, start, stop, status, and package. | Yes |
serverName | Name of the Liberty server instance. The default value is defaultServer. | No |
userDir | Value of the ${wlp_user_dir} variable. The default value is ${installDir}/usr/servers/${serverName}. | No |
outputDir | Value of the ${wlp_output_dir} variable. The default value is ${installDir}/usr/servers/${serverName} | No |
clean | Attributes that determines whether to operate the server using the clean option. | No |
timeout | Waiting time before the server starts or stops. The default value is 30 seconds. The unit is milliseconds. | No |
archive | Location of the compressed file when packaging a server. The value must be a file name and only works for the package option. | No |
ref | Reference to an existing server task definition to reuse its server configuration. The value can be null when other required attributes are set. | No |
Example
This example shows how to use the server task in your build.xml file:
<wlp:server id="wlp.ant.test" installDir="${wlp_install_dir}" operation="start"
serverName="${serverName}" userDir="${wlp_usr}" outputDir="${wlp_output}" />
<wlp:server ref="wlp.ant.test" operation="status"/>