layout | title | categories | author_picture | author_github | seo-title | seo-description | blog_description |
---|---|---|---|---|---|---|---|
post |
Dev mode support in Liberty Maven Plug-in 3.1 |
blog |
Dev mode support in Liberty Maven Plug-in 3.1 - OpenLiberty.io |
Dev mode support and other enhancements made to the Liberty Maven plug-in in 3.1 to simplify and improve the developer experience. |
Dev mode support and other enhancements made to the Liberty Maven plug-in in 3.1 to simplify and improve the developer experience. |
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
.
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 theserver.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
-
Combined the
install-apps
anddeploy
goal functionality into a singledeploy
goal -
Changed the
looseApplication
default value totrue
-
Modified the
package
goal to supportpackageName
,packageDirectory
, andpackageType
parameters 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 io.openliberty.tools
).
---
<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>
---
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!
---
<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.