WAS v8.5 > Reference > Command-line utilities

Liberty profile: Maven goal - liberty:install-server

If we install the Maven plug-in, we can use the liberty:install-server goal to install a Liberty profile server from a compressed archive or a directory that has the server installation files. Additionally, we can assemble a Liberty profile server into a Maven artifact.


Install the server from an existing directory

Usage:

This is the maven goal used to install a server from an existing directory.

     mvn liberty:install-server -DserverHome=/path/to/server_home -DserverName=[server_instance_name]

Example: Installing the server from an existing directory

This is the code snippet that we can use in the pom.xml file of your project.
<plugin>  <groupId>com.ibm.websphere.wlp.maven.plugins</groupId>  <artifactId>liberty-maven-plugin</artifactId> 
 <version>1.0</version>  <configuration>   <serverHome>${project.build.directory}/wlp</serverHome>   
  <background>true</background>  servertest</serverName> </configuration> </plugin>   


Install the server as a Maven artifact

Usage:

This is the command that we can use the Maven plug-in for the Liberty profile to install a server as a Maven artifact.

     mvn liberty:install-server -DassemblyArtifact=[maven_artifact] -DserverName=[worklightServer]

Example: Installing the server as a Maven artifact

This is the code snippet that we can use in the pom.xml file of your project.

    <plugin> <!-- install the liberty server zip into the local maven repo --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <version>2.2</version> <executions> <execution> <id>install-liberty-to-repo</id> <phase>process-resources</phase> <goals> <goal>install-file</goal> </goals> <configuration> <file>wlp***.zip</file> <groupId>com.ibm.ws.liberty.test</groupId> <artifactId>liberty-test-server</artifactId> <version>1.0</version> <packaging>zip</packaging> </configuration> </execution> <!—install the liberty server as maven artifact<plugin> <groupId>com.ibm.websphere.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>install-liberty-server</id> <phase>compile</phase> <goals> <goal>install-server</goal> </goals> </execution> </executions> <configuration> <assemblyArtifact> <groupId>com.ibm.ws.liberty.test</groupId> <artifactId>liberty-test-server</artifactId> <version>1.0</version> <type>zip</type> </assemblyArtifact> servertest</serverName> </configuration> </plugin>


Install a server from a compressed archive

Usage:

This is the command that we can use the Maven plug-in for the Liberty profile to install a server from a compressed archive.

     mvn liberty:install-server -DassemblyArchive=/path/to/assembly.zip

Example: Installing the server from a compressed archive

This is the code snippet that we can use in the pom.xml file of your project.

    <plugin> <groupId>com.ibm.websphere.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.0</version> <configuration> <assemblyArchive>/path/to/compressed_archive</assemblyArchive> </configuration> </plugin>


Parent topic: Use Maven to automate tasks for the Liberty profile


|