server package command
The server package
command packages an Open Liberty server, its resources, and applications in a compressed file that you can store, distribute, or deploy to a different location.
You can select the parts of your Open Liberty server installation to package. You can package an application with a full or a minimal Open Liberty runtime environment, or without an Open Liberty runtime environment so that the application can be deployed on an existing Open Liberty installation.
Usage examples
Generate a ZIP file named myserver.zip
that includes all files in the Open Liberty installation directory with the myserver
server files:
server package myserver --include=all
Generate a ZIP file named package_myserver.zip
that has only the myserver
server files for deployment on an existing Open Liberty runtime installation, such as in a container:
server package myserver --archive=package_myserver.zip --include=usr
Package the Open Liberty runtime into a ZIP file named myPackage.zip
and put it in the C:\temp
directory:
server package --include=wlp --archive=C:\temp\myPackage.zip
Generate a minimal runnable JAR file of the myserver
server named package_myserver.jar
to the C:\temp
directory:
server package myserver --archive=C:\temp\package_myserver.jar --include=minify,runnable
Generate a TAR file of the myserver
server named package_myserver.tar
to the C:\temp
directory:
server package myserver --archive=C:\temp\package_myserver.tar
Package a server with Linux support, but no Windows support:
server package myserver --archive=small.zip --include=minify --os=Linux,-Win32
Syntax
Run the command from the path_to_liberty/wlp/bin
directory. To package a server, stop the server before running the command.
server package serverName [options]
- serverName
The name of the server to run the command against. A server name is needed to package a server. A server name is not needed to package the Open Liberty runtime.
Options
Option | Description |
---|---|
--archive=package_file_name.zip | Specifies a target file for the package operation. This path can be either a relative path, which is relative to the installation root directory of Open Liberty, or an absolute path. The default archive target is a ZIP file with the server name, which is stored in the installation root directory. Use quotation marks if the value contains spaces. ZIP, JAR, TAR, and TAR GZ are all valid archive file options. |
--include=all | Packages all the files in the Open Liberty installation directory. If the |
--include=usr | Packages the files in the |
--include=wlp | Packages the files in the |
--include=minify | Packages only the parts of the runtime environment and files in the |
--include=runnable | Use only with the |
--os=os_value,os_value,… | Use only with the |
--server-root=root_server_folder_in_archive | Specifies the root server folder name in the archive file. By default, the root folder is |
Exit codes
The following exit codes are available for the server package
command and the equivalent executable JAR file ws-server.jar
:
Code | Explanation |
---|---|
0 | This code indicates successful completion of the requested operation. |
1 | This code indicates invocation of a redundant operation. For example, starting a started server or stopping a stopped server. This code might also be returned by JVM if invalid Java options are used. |
2 | This code indicates that the server does not exist. |
3 | This code indicates that an unsupported action was called on a running server. For example, the server is running when the package action is called. |
>=20 | Exit codes that are greater than or equal to 20 indicate that an error occurred while performing the request. Messages are printed and captured in log files with more information about the error. |