The Liberty container runs Java EE 6 and 7 applications on IBM's WebSphere Application Server Liberty Profile. It recognizes Web Archive (WAR) and Enterprise Archive (EAR) files as well applications deployed as a Liberty server directory or packaged server.
Detection Criterion |
|
Tags | liberty-⟨version⟩, WAR (if WAR file is detected), EAR (if EAR file is detected), SVR-DIR (if Liberty server directory is detected), SVR-PKG (if Liberty packaged server is detected) |
If the application uses Spring, Spring profiles can be specified by setting the SPRING_PROFILES_ACTIVE
environment variable. This is automatically detected and used by Spring. The Spring Auto-reconfiguration Framework will specify the cloud
profile in addition to any others.
The Liberty container can be configured by modifying the config/liberty.yml
file in the buildpack fork or by passing an environment variable that overrides configuration in the yml file. The container uses the Repository
utility support and it supports the version syntax.
Name | Description |
---|---|
repository_root |
The URL of the Liberty repository index (details). |
version |
The version of the Liberty profile. You can find the candidate versions here. |
type |
The archive type of Liberty runtime to download. One of webProfile6 , webProfile7 , javaee7 , or kernel . The default value is webProfile7 . |
minify |
Boolean indicating whether the Liberty server should be minified. The default value is false . |
liberty_repository_properties |
Liberty repository configuration. |
app_archive |
Default configuration for WAR and EAR files. |
Minification potentially reduces the size of the deployed Liberty server because only the requested features are included. This might result in longer push times.
The minify
option can be overridden on a per-application basis by specifying a minify
environment variable in the manifest.yml
for the application. For example:
env:
minify: true
By default, the buildpack will download the Liberty features specified in the server.xml
from the Liberty repository. To disable this feature, set the useRepository
option to false
.
liberty_repository_properties:
useRepository: true
When the useRepository
option to true
, you can pass additional properties under the liberty_repository_properties
element to customize the repository information. The additional properties that can be set are defined in the installUtility
documentation. For example, the following specifies a custom feature repository and disables access to the Liberty repository:
liberty_repository_properties:
useRepository: true
useDefaultRepository: false
myRepo.url: http://dev.repo.ibm.com:9080/ma/v1
myRepo.user: myUser
myRepo.userPassword: myPassword
The buildpack provides a default server.xml
configuration when deploying WAR or EAR files. That default configuration is populated with a list of Liberty features based on the ["app_archive"]["features"]
setting. The ["app_archive"]["implicit_cdi"]
setting controls whether archives that do not contain the beans.xml
file are scanned for CDI annotations.
app_archive:
# Scan archives that do not contain beans.xml for bean-definition annotations (cdi 1.2)
implicit_cdi: false
# Default features
features:
- beanValidation-1.1
- cdi-1.2
- ejbLite-3.2
- el-3.0
- jaxrs-2.0
- jdbc-4.1
- jndi-1.0
- jpa-2.1
- jsf-2.2
- jsonp-1.0
- jsp-2.3
- managedBeans-1.0
- servlet-3.1
- websocket-1.1
The Liberty container configuration can be overridden with the JBP_CONFIG_LIBERTY
environment variable. The value of the variable should be valid inline YAML. For example:
-
Configure the Liberty container to enable a custom set of Liberty features (for WAR and EAR files only):
$ cf set-env myApplication JBP_CONFIG_LIBERTY 'app_archive: {features: [jsp-2.3, websocket-1.1]}'
-
Configure the Liberty container to download and install Liberty profile runtime with all Java EE 7 features:
$ cf set-env myApplication JBP_CONFIG_LIBERTY 'type: javaee7'
-
Configure the Liberty container to download and install Liberty profile beta:
$ cf set-env myApplication JBP_CONFIG_LIBERTY 'version: 2015.+'
The environment variables can also be specified in the manifest.yml file.