How to redeploy artifact with liberty-maven-plugin?

john Source

I have IBM Liberty server running on my machine and want to redeploy my WAR using corresponding maven plugin.

The documentation says that there are goals like deploy , undeploy , install-apps . Currently I am using

<plugin>
    <groupId>com.ibm.websphere.wlp.maven.plugins</groupId>
    <artifactId>liberty-maven-plugin</artifactId> 
    <version>1.1</version>
    <executions>
        <execution>
            <id>install-apps</id>
            <phase>install</phase>
            <goals>
                <goal>install-apps</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <serverHome>c:/my-liberty-instance</serverHome>
        <serverName>myServerName</serverName>
    </configuration>
</plugin> 

But it's not good for me because it requires the server instance to be stopped before. If it's running - a new WAR is deployed (it replaces the old one) but no new changes are caught up.

I've tried to use deploy goal but once it copies WAR to the dropins directory - it starts searching some console.log file for some line that should indicate if app is started and FAILS.

Example for undeploy goal : CWWKM2022E: Failed to undeploy application app-1.0-SNAPSHOT.war. The Stop application message cannot be found in console.log. But the same message appears for deploy , stop-server .

Is there a convenient way to redeploy WAR using liberty-maven-plugin where I don't need to restart the server ? I just want to build a new WAR - deploy it; want the server to catch up the changes and that's it.

deploymentmaven-pluginwebsphere-liberty

Answers

answered 1 year ago patricktiu #1

You can use the install-apps goal to install the project war file without your liberty server instance stopped. But you need to use liberty-maven-plugin version 1.3 or above, and also include <installAppPackages>project</installAppPackages> to the plugin configuration.

<plugin>
    <groupId>net.wasdev.wlp.maven.plugins</groupId>
    <artifactId>liberty-maven-plugin</artifactId>
    <version>1.3</version>
    <executions>
        <execution>
            <id>install-apps</id>
            <phase>install</phase>
            <goals>
                <goal>install-apps</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <installDirectory>c:/my-liberty-instance</installDirectory>
        <serverName>myServerName</serverName>
        <installAppPackages>project</installAppPackages>
    </configuration>
</plugin>

comments powered by Disqus