You can use the liberty:package-server goal to package a Liberty profile server.
The liberty:package-server goal can be combined with the liberty:install-apps goal to create a Liberty profile server archive with pre-installed applications.
The following table describes parameters of the package-server goal.
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 Liberty profile: 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 | Name of the Liberty profile server instance. The default value is defaultServer. | No |
configFile | Location of a server configuration file to be used by the instance. The default value is ${basedir}/src/test/resources/server.xml. | No |
bootProps | Location of a bootstrap properties file to be used by the instance. The default value is ${basedir}/src/test/resources/bootstrap.properties. | No |
jvmOptions | Location of a JVM options file to be used by the instance. The default value is ${basedir}/src/test/resources/jvm.options. | No |
serverEnv | Location of a server environment file to be used by the instance. The default value is ${basedir}/src/test/resources/server.env. | No |
overwrite | Overwrite existing configurtion files such as server.xml, bootstrap.properties, jvm.options, or server.env in the target server even if they are newer. The default value is true. Since liberty-maven-plugin version 1.1. | No |
packageFile | Location of the target file or directory. If the target location is a file, the contents of the server instance will be compressed into the specified file. If the target location is a directory, the contents of the server instance will be compressed into ${packageFile}/${serverName}.zip file. If the target location is not specified, it defaults to ${serverHome}/usr/servers/${serverName}.zip if serverHome is set. Otherwise, it defaults to ${installDirectory}/usr/servers/${serverName}.zip if assemblyArchive or assemblyArtifact is set. | No |
<build>
...
<plugins>
<plugin>
<groupId>com.ibm.websphere.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>1.0</version>
<executions>
...
<execution>
<id>package-server</id>
<phase>package</phase>
<goals>
<goal>package-server</goal>
</goals>
<configuration>
<packageFile>${project.build.directory}/test.zip</packageFile>
</configuration>
</execution>
...
<executions>
<configuration>
<serverHome>/opt/ibm/wlp</serverHome>
<serverName>test</serverName>
</configuration>
</plugin>
</plugins>
...
</build>
mvn liberty:package-server -DserverHome=/opt/ibm/wlp -DserverName=test
-DpackageFile=/tmp/test.zip