Collection of Maven plugins and archetypes for managing WebSphere Application Server Liberty Profile and applications.
- Build
- Plugins
- liberty-maven-plugin
- Packaging types
- liberty-assembly
- Archetypes
- liberty-plugin-archetype
Use Maven 2.x or 3.x to build the Liberty plugins and archetypes.
mvn install
: builds the plugin and the archetype.mvn install -Poffline-its -DwlpInstallDir=<liberty_install_directory>
: builds the plugin, archetype and runs the integration tests by providing an existing installation.mvn install -Ponline-its -DwlpVersion=<liberty_version> -DwlpLicense=<liberty_license_code>
: builds the plugin, archetype and runs the integration tests by downloading a new server.- Liberty versions and their respective link to the license code can be found in the index.yml file. You can obtain the license code by reading the current license and looking for the D/N: line.
liberty-maven-plugin
provides a number of goals for managing Liberty Profile server and applications.
To enable liberty-maven-plugin
in your project add the following to your pom.xml
:
<project>
...
<build>
<plugins>
<!-- Enable liberty-maven-plugin -->
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>1.2</version>
<!-- Specify configuration, executions for liberty-maven-plugin -->
...
</plugin>
</plugins>
</build>
...
</project>
If you are using a snapshot version of liberty-maven-plugin
then you will also need to add the following plugin repository to your pom.xml
:
<project>
...
<pluginRepositories>
<!-- Configure Sonatype OSS Maven snapshots repository -->
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
...
</project>
liberty-maven-plugin
must first be configured with Liberty profile installation information. The installation information can be specified as an existing installation directory, a packaged server, or as a Maven artifact. The liberty-maven-plugin
can also download and install Liberty profile server from the Liberty repository or other location using the install parameter.
By default, the plugin will install Liberty runtime with the Java EE 7 Web Profile features from the Liberty repository.
The liberty-maven-plugin
provides the following goals.
Goal | Description |
---|---|
install-server | Installs Liberty profile runtime. This goal is implicitly invoked by all the other plugin goals and usually does not need to be executed explicitly. |
create-server | Create a Liberty Profile server. |
start-server | Start a Liberty Profile server in background. The server instance will be automatically created if it does not exist. |
run-server | Start a Liberty Profile server in foreground. The server instance will be automatically created if it does not exist. |
stop-server | Stop a Liberty Profile server. The server instance must exist and must be running. |
package-server | Package a Liberty Profile server. |
clean-server | Deletes every file in the ${outputDirectory}/logs , ${outputDirectory}/workarea , ${userDirectory}/dropins or ${userDirectory}/apps . |
dump-server | Dump diagnostic information from the server into an archive. |
java-dump-server | Dump diagnostic information from the server JVM. |
deploy | Deploy an application to a Liberty Profile server. The server instance must exist and must be running. |
undeploy | Undeploy an application to a Liberty Profile server. The server instance must exist and must be running. |
install-feature | Install a feature packaged as a Subsystem Archive (esa) to the Liberty runtime. |
uninstall-feature | Uninstall a feature from the Liberty runtime. |
install-apps | Copy applications specified as Maven compile dependencies to Liberty server's dropins or apps directory. |
Parameters shared by all goals. See common parameters.
Additional parameters shared by all server-based goals. See common server parameters.
The liberty-assembly
Maven packaging type is used to create a packaged Liberty profile server Maven artifact out of existing server installation, compressed archive, or another server Maven artifact. Any applications specified as Maven compile dependencies will be automatically packaged with the assembled server. Liberty features can also be installed and packaged with the assembled server.
Example:
<project>
...
<groupId>myGroup</groupId>
<artifactId>myServer</artifactId>
<!-- Create Liberty profile server assembly -->
<packaging>liberty-assembly</packaging>
...
<dependencies>
<!-- Package SimpleServlet.war with server assembly -->
<dependency>
<groupId>wasdev</groupId>
<artifactId>SimpleServlet</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
</dependencies>
...
<build>
<plugins>
<!-- Enable liberty-maven-plugin -->
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>1.2</version>
<extensions>true</extensions>
<configuration>
<installDirectory>/opt/ibm/wlp</installDirectory>
<serverName>test</serverName>
<features>
<acceptLicense>true</acceptLicense>
<feature>mongodb-2.0</feature>
</features>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
liberty-plugin-archetype
is used to generate a basic multi-module project that builds a simple web application, deploys and tests it on the Liberty profile server. It also creates a Liberty profile server package that includes the application.
mvn archetype:generate \
-DarchetypeGroupId=net.wasdev.wlp.maven \
-DarchetypeArtifactId=liberty-plugin-archetype \
-DwlpPluginVersion=1.2 \
-DgroupId=test \
-DartifactId=test \
-Dversion=1.0-SNAPSHOT