back to all blogsSee all blog posts

Dev mode support in Liberty Maven Plug-in 3.1

image of author
Cheryl King on Nov 28, 2019
Post available in languages:

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 liberty-maven-plugin.

What’s new?

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

  • The run goal 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.

What changed?

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

  • Combined the install-apps and deploy goal functionality into a single deploy goal

  • Changed the looseApplication default value to true

  • Modified the package goal to support packageName, packageDirectory, and packageType parameters with logical defaults

For more details, check out the 3.0 release notes.

Simplified pom.xml

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

Example 1

            <!-- Enable liberty-maven-plugin -->

With the 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!

Example 2


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.

So give the 3.1 version of the liberty-maven-plugin a try and let us know what you think! Tap us up on Gitter, or file issues and send us pull requests on GitHub.