Recently we focused on simplifying the use of the Liberty Maven plug-in and improving the developer experience for Open Liberty. This post describes the various enhancements and simplifications that are available in the 3.1 release of
The biggest enhancement is the addition of a development mode, which provides, in any text editor or IDE, hot reload and deployment, on demand testing, and debugger support when you’re developing applications. You can read more about dev mode in the Open Liberty development mode blog post.
Other notable enhancements include:
The ability to specify Liberty configuration with Maven properties
rungoal now implicitly creates the server, installs features referenced by the
server.xml, and deploys the application before starting the server in the foreground
For more details, check out the 3.1 release notes.
In order to simplify the developer experience with the Liberty Maven Plug-in, we made the following changes:
Simplified the goal names
Simplified the server installation to install by default the latest Open Liberty kernel from Maven Central
Changed the precedence for the common server parameters and removed defaults for individual files
deploygoal functionality into a single
looseApplicationdefault value to
packagegoal to support
packageTypeparameters with logical defaults
For more details, check out the 3.0 release notes.
With all of these changes, the
pom.xml configuration for the
liberty-maven-plugin can be greatly simplified. Here are a couple of examples (in versions 3.0 and above, the
groupId of the plugin is
--- <project> ... <build> <plugins> <!-- Enable liberty-maven-plugin --> <plugin> <groupId>io.openliberty.tools</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>3.1</version> </plugin> </plugins> </build> ... </project> ---
pom.xml in Example 1, you can simply run
mvn liberty:run for your project. As a result,
liberty-maven-plugin installs the latest Open Liberty kernel from Maven Central, creates the server, installs features referenced by the
server.xml (which can be placed in the default location for
configDirectory which is
src/main/liberty/config), deploy the application, and start the server in the foreground. No further configuration is required to get started!
--- <properties> <liberty.jvm.minHeap>-Xms512m</liberty.jvm.minHeap> <liberty.env.JAVA_HOME>/opt/ibm/java</liberty.env.JAVA_HOME> <liberty.var.someVariable1>someValue1</liberty.var.someVariable1> <liberty.defaultVar.someDefaultVar1>someDefaultValue1</liberty.defaultVar.someDefaultVar1> </properties> ---
Example 2 shows how to use Maven properties in the
pom.xml to specify Liberty configuration. The properties can also be overridden on the command line using
-D<maven property name>. This provides an easy way to test with different server configurations.