Liberty Gradle Plug-in 3.0-M1
Version 3.0-M1 of the Liberty Gradle Plugin introduces new functionality and configurations. When moving from 2.x, there are new features and behavior differences to take into consideration when updating your project.
The plugin is available under the new io.openliberty.tools
group id in the Maven Central repository.
New capabilities in the liberty-gradle-plugin
There are new capabilities available in the liberty-gradle-plugin
that you might what to use when moving to release 3.0-M1 of the plug-in.
Dev Mode
There is a new libertyDev
task that starts a Liberty server in dev mode. Dev mode provides three key features. Code changes are detected, recompiled, and picked up by your running server. Tests are run on demand when you press Enter in the command terminal where dev mode is running, or optionally on every code change to give you instant feedback on the status of your code. Finally, it allows you to attach a debugger to the running server at any time to step through your code.
Liberty configuration with Gradle project properties
Support is added to specify Liberty configuration using Gradle project properties as described in the Server extension properties. This provides an easy mechanism to override or add Liberty configuration from the command line or as Gradle project properties in the build.gradle
file or gradle.properties
file. The new properties are env
for specifying server.env
variables, defaultVar
for specifying server variables with default values, and var
for specifying server variables with values. The bootstrapProperties
property is also changed from a Map to a Property object. The jvmOptions
can also be specified or overridden using project properties. The libertyCreate
task shows examples of using project properties for Liberty configuration.
Behavior differences in the liberty-gradle-plugin
Changes in property names and defaults for Server extension
In the past, the configFile
, bootstrapPropertiesFile
, jvmOptionsFile
, and serverEnv
Server extension properties had default values. Now these Server extension properties have no default values. If values are specified for these Server extension properties, they will take precedence over files located in the configDirectory
. The configDirectory
defaults to /src/main/liberty/config
. Also, bootstrapProperties
will take precedence over bootstrapPropertiesFile
, and jvmOptions
will take precedence over jvmOptionsFile
. No merging is done.
Previous property name | Previous default value | New property name | New default value |
---|---|---|---|
configFile | ${basedir}/src/main/liberty/config/server.xml |
serverXmlFile | None |
bootstrapPropertiesFile | ${basedir}/src/main/liberty/config/bootstrap.properties |
bootstrapPropertiesFile | None |
jvmOptionsFile | ${basedir}/src/main/liberty/config/jvm.options |
jvmOptionsFile | None |
serverEnv | ${basedir}/src/main/liberty/config/server.env |
serverEnvFile | None |
Order of precedence (from highest to lowest):
- Inlined configuration - bootstrapProperties, jvmOptions
- Specified file - bootstrapPropertiesFile, jvmOptionsFile, serverEnvFile, serverXmlFile
- File located in
configDirectory
(which defaults to${basedir}/src/main/liberty/config
)
Moved properties from install block
The buildDir
and cacheDir
properties are moved from the install block to the general runtime properties.
Simplified server installation
In the past, if no libertyRuntime
dependency or install
block was specified, the latest Liberty runtime was installed from DHE. Now by default, the latest Open Liberty kernel is installed from Maven Central. The new liberty.runtime
properties can be specified on the command line or as a Gradle project property to override the group
, name
or version
of Liberty that is installed. These are general runtime properties shared by all goals.
Changed libertyPackage task
The libertyPackage
task is changed. The new packageType
property supports values zip
, jar
, tar
, and tar.gz
. The archive
property is removed. The packageName
, packageDirectory
and packageType
should be used instead. The serverRoot
property is also added. When runnable
is specified in the include
property, the packageType
defaults to jar. If jar
is specified for packageType
without runnable
in the include
property, a self-extracting jar file is created.
Changed deploy task and undeploy task and removed installApps task
The deploy
task is changed to handle both copying and deploying of applications to a Liberty server, depending on the status of the server. If the server is not running, the applications are simply copied onto the server. If the server is running, the applications are deployed and verified to have started on the server. The installApps
task is removed. For the undeploy
task either the apps
property or dropins
property must be specified to indicate which tasks/files should be undeployed.