Dev mode with container support in Liberty Maven and Gradle Plug-ins
In this blog post, we introduce the general availability of container support in dev mode and support for copying dependencies. Both of these new capabilities are included in the latest releases of the Liberty Maven and Gradle Plug-ins.
Dev mode with containers
If you are developing an application locally in a container, you can minimize differences between your development and production environments by running your containerized server in dev mode. With container support for dev mode, you can use the same Dockerfile for both development and production. You use the same base image and customizations, and specify the same configuration files in your Dockerfile that you use for your application in production.
In dev mode, your code changes are automatically hot deployed to the container and picked up by the running server. Additionally, dev mode allows you to run tests either automatically or on demand, and you can attach a debugger at any time to debug your application that’s running in the container.
Container support in dev mode was previously available as a tech preview and is now generally available to use. Check out our previous blog post to find out more about how this feature lets you iterate quickly in developing your containerized application.
For more information about using this feature, see Container support for dev mode in the Open Liberty docs.
Copying dependencies
The Liberty Maven Plug-in now provides support for copying dependencies during server creation with the copyDependencies
parameter.
If a dependency isn’t listed in the Maven dependencies
section of the pom.xml
file, then the full group, artifact, and version coordinates need to be specified in the copyDependencies
configuration. Alternatively, you can copy all resolved dependencies that match a specific groupId
, or a specific groupId
and artifactId
. The artifactId
may also end with a *
to match all artifacts that have an artifactId
that start with the specified string. Transitive dependencies are also copied. Additionally, a stripVersion
parameter is available to strip the version during the copy.
For further configuration details, see the new copyDependencies
parameter in the common server parameters section of the Liberty Maven Plug-in documentation.
Using the plug-ins
For Maven projects, specify the latest version of the Liberty Maven Plug-in in your project pom.xml
file:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.3.4</version>
</plugin>
For Gradle projects, specify the latest version of the Liberty Gradle Plug-in in your project build.gradle
file:
apply plugin: 'liberty'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.1.2'
}
}
After you add the plug-in, run one of the Liberty Maven goals or Gradle tasks to get started!