Maven goal - liberty:deploy
We can use the liberty:deploy goal to deploy an application to a Liberty profile server.
The liberty:deploy goal deploys the specified application to the dropins/ directory of the Liberty profile server. The server must exist and must be running.
Parameters
The following table describes parameters of the deploy goal.
parameters of the deploy goal.
The first column contains a list of parameters, the second column contains a description of each parameter, and the third column states whether this parameter is required.
Parameter Description Required serverHome Directory location of the Liberty profile server installation. Yes, only when assemblyArchive and assemblyArtifact parameters are not set. assemblyArchive Location of the Liberty profile server compressed archive. The archive will be unpacked into a directory as specified by the installDirectory parameter. Yes, only when serverHome and assemblyArtifact parameters are not set. assemblyArtifact Maven artifact name of the Liberty profile server assembly. The assembly will be installed into a directory as specified by the installDirectory parameter. For more information on Liberty profile server Maven assemblies, see Installation as a Maven artifact. Yes, only when serverHome and assemblyArchive parameters are not set. installDirectory Local installation directory location of the Liberty profile server when the server is installed using the assembly archive or artifact option. The default value is ${project.build.directory} /liberty. No refresh If true, re-install Liberty profile server into the local directory. This is only used when when the server is installed using the assembly archive or artifact option. The default value is false. No serverName Liberty profile server instance. The default value is defaultServer. No appArchive Location of an application file to be deployed. The application type can be war, ear, rar, eba, zip, or jar. Yes, if appArtifact parameter is not set. appArtifact Maven artifact name of an application to be deployed. The application type can be war, ear, rar, eba, zip, or jar. Since liberty-maven-plugin version 1.1. Yes, if appArchive parameter is not set. timeout Maximum time to wait (in milliseconds) to verify that the deployment has completed successfully. The default value is 40 seconds. No
- Example: deploying an application
- This is the code snippet we can use in the pom.xml file of the project.
<build> ... <plugins> <plugin> <groupId>com.ibm.websphere.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.0</version> <executions> ... <execution> <id>deploy-app</id> <phase>pre-integration-test</phase> <goals> <goal>deploy</goal> </goals> <configuration> <appArchive>HelloWorld.war</appArchive> </configuration> </execution> ... <executions> <configuration> <serverHome>/opt/ibm/wlp</serverHome> <serverName>test</serverName> </configuration> </plugin> </plugins> ... </build>
- Example: deploying an application from command line
This is the Maven command we can leverage to deploy an application to the server.
mvn liberty:deploy -DserverHome=/opt/ibm/wlp -DserverName=test -DappArchive=/tmp/HelloWorld.war
Parent topic: Use Maven to automate tasks