When moving to release 2.0 of the liberty-maven-plugin from an earlier version, there are new
features and behavior differences to take into consideration when updating your project.
- Maven dependencies
- New features in liberty-maven-plugin
- Behavior differences in the liberty-maven-plugin
- Archetypes
Updates to the liberty-maven-plugin require the use of Maven 3.0 or higher.
There are new capabilities available in the liberty-maven-plugin that you might what to use when moving to release 2 of the plug-in.
Loose applications are applications composed from multiple physical locations described by an XML file. In development, they allow easy updates to classes and files without repackaging an application archive. The liberty-maven-plugin can now install web applications using loose application XML with the install-apps goal and the looseApplication parameter. The package-server goal will create a WAR file from the loose application XML file description and package the WAR with the server archive.
There is a new common server parameter that allows you to copy a directory of server
configuration files. If you are using files included in your server.xml file, then with one configuration element,
you can copy all your configuration related files if they are in one folder. It supports nested directories.
There are two new goals to assist with integration test. The test-start-server and
test-stop-server goals honor elements, such as skipTests, skipITs, and maven-test-skip, used to skip the testing phases.
You can update the Liberty runtime license to a production license using the install-server goal.
The new debug-server goal allows you to pause the server during foreground start so that a debugger
can be attached to the server process.
In previous releases of the liberty-maven-plugin, applications are installed in the dropins directory by default.
This location could be overridden by the appsDirectory parameter. This default causes problems if the
application was also configured in the server.xml or other server configuration file.
Starting with release 2.0 of the plug-in, the default appsDirectory and the plug-in behavior depends on whether
the application is configured for the server or not. Errors and warnings will be issued for situations that would
pass the goal but not run properly on the server.
| Application is configured | Application is not configured | |
|---|---|---|
appsDirectory not set |
Install to the apps folder. |
Install to the dropins folder. |
appsDirectory set to dropins |
install-apps goal will generate an error. |
Install to the dropins folder |
appsDirectory set to apps |
Install to the apps folder. |
Add webApplication configuration to the target configDropins folder. Produce a warning message telling user to configure the application in the source server configuration. |
By default, when the packageFile parameter is not set on the package-server goal, the goal would put the archive at unexpected locations defined by the server package command. Now, by default packages are created in the target folder with naming described in the package-server goal documentation.
In the past, the stop-server goal would fail if the server package was not valid or could not run the stop. Now you will get a warning since in most failure cases, the server was not running. The goal would also try to install the server if it was not already installed. It no longer installs the server. The goal will try its best to stop the server, but if it cannot, it will not fail the build.
The default lifecycle for the liberty-assembly packaging type binds more goals than in the previous release. This allows you to have a more simplified pom file when you are running a typical build lifecycle for application development. The following chart shows all the goals that are bound in the release 2.0 plug-in and whether it is a new goal or not.
| Phase | Goal | New |
|---|---|---|
| pre-clean | liberty:stop-server | yes |
| process-resources | maven-resources-plugin:resources | no |
| compile | maven-compiler-plugin:compile | yes |
| process-test-resources | maven-resources-plugin:testResources | no |
| test-compile | maven-compiler-plugin:testCompile | yes |
| test | maven-surefire-plugin:test | yes |
| prepare-package | liberty:install-server, liberty:create-server, liberty:install-feature | no |
| package | liberty:install-apps, liberty:package-server | no |
| pre-integration-test | liberty:test-start-server | yes |
| integration-test | maven-failsafe-plugin:integration-test | yes |
| post-integration-test | liberty:test-stop-server | yes |
| verify | maven-failsafe-plugin:verify | yes |
| install | maven-install-plugin:install | no |
| deploy | maven-deploy-plugin:deploy | no |
liberty-archetype-webapp is used to generate a basic single-module project that builds a simple web application then deploys and tests is on a Liberty server. It also creates a minified, runnable Liberty server package that includes the application. The generated project includes liberty-maven-app-parent parent pom that binds liberty-maven-plugin goals to the Maven default build lifecycle.