This topic applies to WebSphere Application Server Liberty V8.5.5.9 and earlier. For the latest Liberty topics, see the WebSphere Application Server Liberty documentation.

Using Maven to automate tasks for Liberty

Apache Maven is a software project management tool based on the concept of a project object model (POM). You can use the Maven plug-in that is provided for Liberty to manage the server and applications.

Before you begin

Important: An open source Liberty Maven plug-in with more goals for Liberty is available. The open source Liberty Maven plug-in has a different group ID, net.wasdev.wlp.maven.plugins, than the original Liberty plug-in. Documentation on using Maven to automate Liberty tasks and the available Maven goals is located and updated in GitHub.

The open source Maven plug-in for Liberty is available in the Maven Central repository and no longer requires plug-in repository configuration in the pom.xml file. The following examples show how to configure the liberty-maven-plugin in your project.

The Liberty Maven plug-in must be configured with Liberty server installation information. The installation information can be specified as an existing installation directory, a compressed archive, or as a Maven artifact.
  • Configure with existing installation directory.
    Use the installDirectory parameter to specify the directory of an existing Liberty server installation. For example:
            ...
            <plugin>
                <groupId>net.wasdev.wlp.maven.plugins</groupId>
                <artifactId>liberty-maven-plugin</artifactId> 
                <version>1.2.1</version>
                <configuration>
                    <installDirectory>/opt/ibm/wlp</installDirectory>
                </configuration>
            </plugin>
            ...
  • Configure with compressed archive.
    Use the assemblyArchive parameter to specify a compressed archive that contains the Liberty server files. For example:
            ...
            <plugin>
                <groupId>net.wasdev.wlp.maven.plugins</groupId>
                <artifactId>liberty-maven-plugin</artifactId> 
                <version>1.2.1</version>
                <configuration>
                    <assemblyArchive>/opt/ibm/wlp.zip</assemblyArchive>
                </configuration>
            </plugin>
            ...
  • Configure with Maven artifact name.
    Use the assemblyArtifact parameter to specify the name of the Maven artifact that contains the Liberty server files. For example:
            ...
            <plugin>
                <groupId>net.wasdev.wlp.maven.plugins</groupId>
                <artifactId>liberty-maven-plugin</artifactId> 
                <version>1.0</version>
                <configuration>
                    <assemblyArtifact> 
                        <groupId>com.ibm.ws.liberty.test</groupId> 
                        <artifactId>liberty-test-server</artifactId>
                        <version>1.0</version>
                        <type>zip</type>
                    </assemblyArtifact>         
                </configuration>
            </plugin>
            ...
    For more information on installing the Liberty server as a Maven artifact, see Installation as a Maven artifact.

About this task

You can use the provided Maven plug-in to create, start, stop, and package a Liberty server, and test your application on Liberty. Each task is represented by a specific goal in Maven.


Icon that indicates the type of topic Task topic



Timestamp icon Last updated: Tuesday, 12 December 2017
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=twlp_dev_maven
File name: twlp_dev_maven.html