-
Notifications
You must be signed in to change notification settings - Fork 626
Description
The information you provide here will be included in the Open Liberty GA release blog post (example), which will be published on openliberty.io/blog/, and potentially elsewhere, to promote this newly released feature/function of Open Liberty. For this post to be included in the GA issue please make sure that this is completed by the end of Friday following the GM (Wednesday). The beta and release blogs are created using automation and rely on you following the template's structure. DO NOT REMOVE/ALTER THE <GHA> TAGS THROUGHOUT THIS TEMPLATE.
Please provide the following information:
-
If this was previously published in a beta blog post, then provide the link to that
OpenLiberty/open-libertybeta blog post issue on the next line between the<GHA-BLOG-BETA-LINK>tags. If nothing has changed since the beta, you're done and can omit the remaining steps. If you need to make updates/alterations to the beta content, then do all the steps.
https://github.com/OpenLiberty/open-liberty/issues/0
##Java Toolchains in Liberty Build Plugins
In the latest release of the Liberty build plugins, support has been added for Java Toolchains. This enhancement allows developers to decouple the JDK used to run their build tools (Maven or Gradle) from the JDK used to run the Liberty server and their applications, providing greater flexibility and environmental consistency.
###Java Toolchains support
The Liberty build plugins now support the standard Java Toolchain mechanism.
Previously, the Liberty build plugins were restricted to using the same JDK for running the Liberty server as for running Maven or Gradle itself.
This prevented developers from using more recent JDK versions for their build process if their applications required a specific older JDK version.
With Java Toolchains, you can now run your build tool on a modern JDK (e.g. Java 25) while ensuring the Liberty server and all server operations execute on a different configured JDK (e.g. Java 8).
###Maven Plugin integration
The Liberty Maven Plugin now integrates seamlessly with the maven-toolchain-plugin as of version 3.12.0.
To use this feature, define your available JDKs in your ~/.m2/toolchains.xml file and then configure tag in .
The plugin will automatically detect and use the toolchain specified in your project’s pom.xml.
For detailed configuration steps and parameters, see the Liberty Maven Plugin toolchain documentation.
The plugin will honor the JDK vendor and version constraints defined in your Maven profiles, ensuring your server environment remains consistent across different developer machines and CI/CD pipelines.
###Gradle Plugin integration
The Liberty Gradle Plugin now honors the native java { toolchain { ... } } configuration block as of version 3.10.0. This provides a unified way to manage Java versions in multi-project builds where different services may have different runtime requirements.
For detailed configuration steps and parameters, see the Liberty Gradle Plugin toolchain documentation.
When a toolchain is configured in your build.gradle, the Liberty Gradle Plugin will use that specific Java runtime for all server-related tasks (e.g. libertyDev and libertyStart).
###Try it now
To enable Java Toolchains, upgrade to the latest Liberty Maven or Gradle plugins and apply the following configuration.
For Maven:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<jdkToolchain>
<version>11</version>
<vendor>temurin</vendor>
</jdkToolchain>
</configuration>
</plugin>
For Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.10.0'
}
}
apply plugin: 'liberty'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
// Optional: specify vendor
// vendor = JvmVendorSpec.ADOPTIUM
}
}
What happens next?
- Add the label for the GA you're targeting:
target:YY00X. - Make sure this blog post is linked back to the Epic for this feature/function.
- Your paragraph will be included in the GA release blog post. It might be edited for style and consistency.
- You will be asked to review a draft before publication.
- Once you've approved the code review, close this issue.
- If you would also like to write a standalone blog post about your update (highly recommended), raise an issue on the Open Liberty blogs repo. State in the issue that the blog post relates to a specific release so that we can ensure it is published on an appropriate date (it won't be the same day as the GA blog post).