Apache Maven is a software project management tool based on the concept of a project
object model (POM). You can use the Liberty
Maven plug-in to manage your runtime and applications.
Before you begin
You can use the open source Liberty Maven
plug-in to create, start, stop, and package the Liberty runtime, and to test your applications on
Liberty. Each task is represented by a
specific goal in Maven. This plug-in, which is available under the
io.openliberty.tools
group ID, supports both WebSphere Liberty and Open Liberty.
Documentation on using Maven to automate Liberty tasks and the available Maven goals is
located and updated in the Liberty Maven Plug-in documentation in GitHub.
About this task
You can configure the Liberty Maven
plug-in with Liberty runtime installation
information. The installation information can be specified as Maven coordinates, as an existing
installation directory, or as a compressed archive. If no runtime installation is configured, the
default artifact is used, which includes the latest version of
the full Open Liberty runtime kernel.
The following examples specify the 3.7.1 version of the Liberty Maven plug-in. For more
information about the latest available version of the plug-in, see the Liberty Maven Plug-in
documentation in GitHub.
Procedure
- Configure a Liberty installation
by using Maven coordinates.
Use the
runtimeArtifact
parameter to specify the coordinates (group name,
artifact ID, and version) of the Maven artifact that contains
Liberty runtime files, as shown in the following
example. This example specifies the coordinates for the
WebSphere Liberty runtime with all Jakarta EE 9
features.
...
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<runtimeArtifact>
<groupId>com.ibm.websphere.appserver.runtime</groupId>
<artifactId>wlp-jakartaee9</artifactId>
<version>22.0.0.10</version>
<type>zip</type>
</runtimeArtifact>
</configuration>
</plugin>
...
For a list of the available coordinates for WebSphere Liberty and Open Liberty, see Using a Maven artifact.
- Configure an installation by using an existing Liberty installation directory.
Use the
installDirectory
parameter to specify the directory of an existing
Liberty runtime installation, as shown in the
following example.
...
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<installDirectory>/opt/ibm/wlp</installDirectory>
</configuration>
</plugin>
...
- Configure an installation by using a compressed Liberty archive.
Use the
runtimeArchive
parameter to specify a compressed archive that contains
Libertyruntime files, as shown in the
following example.
...
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<runtimeArchive>/opt/ibm/wlp.zip</runtimeArchive>
</configuration>
</plugin>
...