Simplify feature selection with versionless features

Versionless features provide a generic way to specify Open Liberty features without having to specify a feature version. These features automate version selection, so you can focus on application development without worrying about feature compatibility issues.

Versionless features are available for the MicroProfile, Jakarta EE, and Java EE platforms. They are supported only in server environments, not in client environments.

Enabling versionless features

To enable versionless features, you must declare a corresponding versioned platform. You have three options to declare a platform:

Specify a platform element inside the featureManager element of your server.xml file

You can declare a platform version by specifying a platform element inside the featureManager element of your server.xml file. This method is the simplest way to configure and manage your versionless features.

For example, the following server.xml file configuration specifies a Jakarta EE platform of jakartaee-9.1, with associated versionless features for servlet, persistence, and restfulWS:

<featureManager>
    <platform>jakartaee-9.1</platform>
    <feature>servlet</feature>
    <feature>jpa</feature>
    <feature>jaxrs</feature>
</featureManager>

With this configuration, Open Liberty automatically resolves each feature to the version that is included in the Jakarta EE 9.1 platform.

Similarly, the following example enables versionless MicroProfile features that are included in the MicroProfile 5.0 platform:

<featureManager>
  <platform>microProfile-5.0</platform>
  <feature>mpHealth</feature>
  <feature>mpMetrics</feature>
</featureManager>

Specify the PREFFERED_PLATFORM_VERSIONS environment variable

Alternatively, you can declare platforms for versionless features by defining the PREFERRED_PLATFORM_VERSIONS environment variable in your server.env file, as shown in the following example:

PREFERRED_PLATFORM_VERSIONS=microProfile-5.0,jakartaee-9.1

When this environment variable is set, you can specify versionless features in your server.xml file and Open Liberty automatically resolves them to the correct version. In this server.xml file example, the mpHealth and mpMetrics features resolve to versions that are included in MicroProfile 5.0:

<featureManager>
    <feature>mpHealth</feature>
    <feature>mpMetrics</feature>
</featureManager>

You can also set the PREFERRED_PLATFORM_VERSIONS environment variable from the environment shell. However, this method might cause problems if you need to package the server by running the server package command. When you set PREFERRED_PLATFORM_VERSIONS in the server.env file, server packaging retains the setting is retained when you run the server package command. When the server image is unpacked, the server.env file still has the PREFERRED_PLATFORM_VERSIONS setting.

If you set the PREFERRED_PLATFORM_VERSIONS environment variable in the environment shell, the variable is not retained when the server is packaged. If this scenario occurs, the server package command issues the following warning:

CWWKE0969W: A manual PREFERRED_PLATFORM_VERSION environment variable was specified during server packaging.

After you unpack the server image, you must provide a definition of the PREFERRED_PLATFORM_VERSIONS variable to the server.

Enable a versioned feature from a supported platform in your server.xml file

You can declare a platform implicitly by enabling at least one versioned feature that is included in only one supported platform version. Open Liberty then automatically resolves versionless features from that platform to their corresponding versions.

In the following server.xml example, the mpHealth-3.0 feature is part of the MicroProfile 4.0 platform, and no other MicroProfile platform. Open Liberty automatically resolves the versionless mpMetrics and mpConfig features to the versions that are included in MicroProfile 4.0:

<featureManager>
  <feature>mpHealth-3.0</feature>
  <feature>mpMetrics</feature>
  <feature>mpConfig</feature>
</featureManager>

However, this strategy does not work if you declare a feature version that is part of more than one platform, such as mpConfig-2.0, which is included in both MicroProfile 4.0 and MicroProfile 4.1. This strategy is useful primarily for simple configurations, where only a few features are enabled. If you specify multiple versioned features that are part of the same platform, but different platform versions, versionless features might not resolve correctly. For more complex configurations, declare a platform explicitly in a platform element.

Available platforms and versionless features

The following tables list the currently available MicroProfile, Jakarta EE, and Java EE platform versions and their corresponding versionless features. You can declare up to 2 platform elements, one for MicroProfile and another for either Jakarta EE or Java EE.

Only features that are included in the supported platforms are available in versionless format. For example, because the springBoot-3.0 feature is not specifically included in the MicroProfile, Jakarta EE, or JavaEE platforms, no springBoot versionless feature is available.

MicroProfile

Declare a platform version by using any of the three strategies that are described in the previous sections. Open Liberty automatically resolves any versionless features that you enable in your server.xml file to the version that is included in your specified platform version.

MicroProfile platforms and versionless features
Platform versionsFeature nameVersionless feature short name

* microProfile-1.2

* microProfile-1.3

* microProfile-1.4

* microProfile-2.0

* microProfile-2.1

* microProfile-2.2

* microProfile-3.0

* microProfile-3.2

* microProfile-3.3

* microProfile-4.0

* microProfile-4.1

* microProfile-5.0

* microProfile-6.0

* microProfile-6.1

MicroProfile Config

mpConfig

MicroProfile Fault Tolerance

mpFaultTolerance

MicroProfile Health

mpHealth

MicroProfile JSON Web Token

mpJwt

MicroProfile Metrics

mpMetrics

MicroProfile OpenAPI

mpOpenAPI

MicroProfile Open Tracing

mpOpenTracing

MicroProfile Rest Client

mpRestClient

MicroProfile Telemetry

mpTelemetry

Java EE and Jakarta EE

Declare a platform version by using any of the three strategies that are described in the previous sections. Open Liberty automatically resolves any versionless features that you enable in your server.xml file to the version that is included in your specified platform version. Liberty uses different feature names and short names for some Java EE and Jakarta EE versions of the same feature. In these cases, you can use either short name and the platform you specify pulls in the correct compatible feature.

Jakarta EE platforms and versionless features
Platform versionsFeature nameVersionless feature short name
  • jakartaee-9.1

  • jakartaee-10.0

Application Client Support for Server

appClientSupport

Application Security

appSecurity

Batch API

batch

Bean Validation

beanValidation

Contexts and Dependency Injection

cdi

Jakarta Authentication

appAuthentication

Jakarta Authorization

appAuthorization

Jakarta Concurrency

concurrent

Jakarta Connectors

connectors

Jakarta Connectors Inbound Security

connectorsInboundSecurity

Jakarta Enterprise Beans

enterpriseBeans

Jakarta Enterprise Beans Home

enterpriseBeansHome

Jakarta Enterprise Beans Lite

enterpriseBeansLite

Jakarta Enterprise Beans Message-Driven Beans

mdb

Jakarta Enterprise Beans Persistent Timer

enterpriseBeansPersistentTimer

Jakarta Enterprise Beans Remote

enterpriseBeansRemote

Jakarta Expression Language

expressionLanguage

Jakarta Faces

faces

Jakarta Faces Container

facesContainer

Jakarta JavaScript Object Notation Binding

jsonb

Jakarta JavaScript Object Notation Binding Container

jsonbContainer

Jakarta JavaScript Object Notation Processing

jsonp

Jakarta JavaScript Object Notation Processing Container

jsonpContainer

Jakarta Mail

mail

Jakarta Managed Beans

managedBeans

Jakarta Messaging

messaging

Jakarta Persistence

persistence

Jakarta Persistence Container

persistenceContainer

Jakarta RESTful Web Services

restfulWS

Jakarta RESTful Web Services Client

restfulWSClient

Jakarta Servlet

servlet

Jakarta Server Pages

pages

Jakarta WebSocket

websocket

Jakarta XML Binding

xmlBinding

Jakarta XML Web Services

xmlWS

Java Database Connectivity

jdbc

Messaging Server

messagingServer

Messaging Server Client

messagingClient

Messaging Server Security

messagingSecurity

Java EE platforms and versionless features
Platform versionsFeature nameVersionless feature short name
  • javaee-7.0

  • javaee-8.0

Application Client Support for Server

appClientSupport

Application Security

appSecurity

Batch API

batch

Bean Validation

beanValidation

Contexts and Dependency Injection

cdi

Concurrency Utilities for Java EE

concurrent

Enterprise JavaBeans

ejb

Enterprise JavaBeans Home

ejbHome

Enterprise JavaBeans Lite

ejbLite

Enterprise JavaBeans Persistent Timer

ejbPersistentTimer

Enterprise JavaBeans Remote

ejbRemote

Expression Language

el

Java Authentication SPI for Container

jaspic

Java Authorization Contract for Containers

jacc

Java Connector Architecture

jca

Java Connector Architecture Security Inflow

jcaInboundSecurity

Java Database Connectivity

jdbc

Java EE Managed Bean

managedBeans

Java Message Service

jms

Java Persistence API

jpa

Java Persistence API Container

jpaContainer

Java RESTful Services

jaxrs

Java RESTful Services Client

jaxrsClient

Java Servlets

servlet

Java WebSocket

websocket

Java XML Bindings

jaxb

Java Web Services

jaxws

JavaMail

javaMail

JavaScript Object Notation Binding (javaee-8 only)

jsonb

JavaScript Object Notation Binding Container (javaee-8 only)

jsonbContainer

JavaScript Object Notation Processing

jsonp

JavaScript Object Notation Processing Container

jsonpContainer

JavaServer Faces

jsf

JavaServer Faces Container

jsfContainer

JavaServer Pages

jsp

JMS Client for Message Server

wasJmsClient

J2EE Management

j2eeManagement

Message-Driven Beans

mdb

Message Server

wasJmsServer

Message Server Security

wasJmsSecurity