Incremental hot deployment on Tomcat with Maven and NetBeans

不羁岁月 提交于 2019-11-30 18:24:11

I spent a lot of time trying to get this work. Finally I just used jetty. I put this:

   <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <reload>automatic</reload>
                <scanIntervalSeconds>5</scanIntervalSeconds>
            </configuration>
   </plugin>

Maybe all parameters are not correct, but then I created a custom goal of 'jetty:run' And I use that. I can't use the big green play button 'Run', but the jetty deploy works nicely and it hot deploys any changes in the Java classes.

Take a look at JRebel. It should do what you want. Painlessly.

Have a look at Hot Deployment of a Web Application with Maven in NetBeans. I also suggest to check Glassfish Hot Code Re-deployment (on Maven), especially the post about Compile on Save, and to try GlassFish, you may get better results.

mdma

Use the tomcat:inplace goal to invoke your webapp from its compiled classes and sources.

You may experience file locking problems on Windows. There are several workarounds, such as the antiJarLocking contet attribute, but essentially this boils down to your webapp not properly shutting down, whch will eventually exhaust your VMs memory after several reloads. In my case, I was using Spring, and the "proper" fix was to add a destroy-method on some key beans so that the app was gracefully shutdown.

Maven Tomcat Plugin - tomcat:inplace

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