How to redeploy artifact with liberty-maven-plugin?

馋奶兔 提交于 2019-12-12 06:36:09

问题


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.


回答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>


来源:https://stackoverflow.com/questions/44267433/how-to-redeploy-artifact-with-liberty-maven-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!