Maven + Tomcat hot deploy

◇◆丶佛笑我妖孽 提交于 2019-12-04 12:22:22

I find that maven tomcat plugin is slow because it always use the tomcat's client deployer and deploys by the http calls on the manager like localhost:8080/manager/text

Tomcat has a web application reloading mechanism managed by "autoDeploy" that you can read about it here. So being that it reloads whenever the application war is changed I have made the following change to my maven-war-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <outputDirectory>${my.tomcat.path}</outputDirectory>
    </configuration>
</plugin>

where

<properties>
    <my.tomcat.path>[MY TOMCAT WEBAPP PATH]</my.tomcat.path>
</properties>

After this I only need to do mvn compile war:war or mvn compile package

You can try the maven tomcat plugin - specifically the tomcat:run goal. You can also configure maven eclipse plugin to create a dynamic web project and then deploy from within eclipse.

That sounds to me like JRebel. (sorry for the commercial).

Maven integration with Netbeans does this for you. Just File->Open your project, click Run (which deploys and spawns a web browser for testing), then modify your code in the IDE and each time you click save it will hot deploy changes.

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