+

Search Tips   |   Advanced Search

Packaging a Liberty profile server from the command prompt

From the command prompt, we can create a compressed file containing a Liberty profile runtime environment, the files in the shared resources directory, a specific server, and the applications that are embedded in the server. We can also choose to exclude the runtime binary files from the compressed file.

The Liberty server is lightweight, and therefore we can package a server installation in a compressed file. We can store this package, distribute it to colleagues, and then use it to deploy the installation to a different location or to another machine, or even embed the installation in a product distribution.

Note The resulting file is created using UTF-8 encoding for entry names, so the tool that we use to open the file must be able to use UTF-8 encoding for entry names. The jar command in a Java SDK uses this format.

To package a Liberty profile server from the command prompt:

  1. Open a command prompt, then change directory to the wlp/bin directory.

  2. Stop the server.

  3. Package the server.

    The default archive format is .zip on all platforms apart from z/OS where it is .pax. We can also generate a .jar archive.

    If we do not specify a server name, defaultServer is used. If we do not specify the --archive parameter, the value of server_name is used for package_file_name, and the compressed file is created in the ${server.output.dir} directory.

    Choose the correct command for the environment.

    • Use this command to generate a .zip archive.

        server package server_name --archive=package_file_name.zip --include=all

      where package_file_name.zip is a file name we choose. This file name can include a full path name. If the full path is omitted, a compressed file called package_file_name.zip is created in the ${server.output.dir} directory.

    • Use this command to generate a .jar archive. The advantage of a .jar archive is that the scripts in the bin directory keep their permissions, so they are executable when the package is installed.

        server package server_name --archive=package_file_name.jar --include=all

      where package_file_name.jar is a file name we choose.

      For more information about extraction options with this archive file, see Archive file extraction options.

We can also use the --include option with this command. For example, the --include=all option packages the runtime binaries and the relevant files in the ${WLP_USER_DIR} directory; the --include=usr option packages only relevant files in the ${WLP_USER_DIR} directory, effectively excluding the runtime binaries from the compressed file.

The --include=usr option is not valid with an archive format of .jar.

If we use the --include=minify option, the server command packages only those parts of the runtime environment, and files in the ${WLP_USER_DIR} directory, required to run the server. This option significantly reduces the size of the resulting archive.

The parts of the runtime environment that are retained by the minify operation depend on the features configured in the server that we are packaging. Only those features required to run the server are retained, and the remaining features are removed. Therefore, we cannot later enable a feature that has been removed. For example, if only the servlet-3.0 feature is retained, we cannot later enable the jpa-2.0 feature.

We can repeat the minify operation to further reduce the size of the archive if the configuration is changed. There is, however, no reverse operation for the minify operation, so if you later require one or more features that have been removed, we must begin again with a complete Liberty profile server.

While the minify operation is running, the server is temporarily started, and you see the associated messages. For this reason, we cannot use the --include=minify option with a server that is not able to be started, but we can package it with the --include=all or --include=usr options.

We can specify the operating systems we want the packaged server to support using the --os option with the --include=minify option.

For example, to package a server with z/OS support removed, use the following command:

To package a server with OS/400 support retained, but z/OS support removed, use the following command:

To package a server that supports only Linux, use the following command:


Parent topic: Administer the Liberty profile from the command prompt


Parent topic: Deploy applications to the Liberty profile

  • Packaging Liberty profile resources
    Submitting jobs to manage Liberty profile servers
    server command options
    Archive file extraction options