Redeploying Java EE applications immediately

流过昼夜 提交于 2019-12-05 01:48:58

I've found neither credible nor official sources but since you have no answers I'd like to point out two things I've discovered.

The first is this FAQ on the NetBeans site describing how to turn on compile on save for a Maven project. It appears that this setting is off by default and only on by default for tests. For convenience:

Go to the project properties dialog, Compile panel, to turn it on for main source execution as well.

The second is, and I must stress that I don't quite understand this completely, there seems to be two different ways that NetBeans deploys a Web Application. The first way is an in-place deployment that appears to be the same as deploying a .war file to the server manually. The second is an incremental deployment, which if it's anything like incremental compilation it means that when your app is hot-deployed you are only deploying the changed files.

The in-place deployment seems to be the default method of deployment when you either click Run or Deploy from the projects' context menu. The incremental deployment happens when your project is already deployed and you click Run again (or use the Run toolbar button).

I'd like to point out that the NetBeans FAQ, although on the netbeans.org website is not an official publication. Anyone can create a FAQ and the information can and will become obsolete without revision.

Edit: After a little reflection I've decided that the so called incremental deployment is not a different way of deployment it's just that the second time you Run your application it does an incremental deployment.

Edit: Notice that the instruction above is pointing you to the Compile panel as opposed to the Run panel that you have selected in your screenshot. Here's my screen shot showing that you need to choose for both application and test execution in the Compile panel drop down and that the default is for test execution only

JRebel is compatible with NetBeans 7.0 (http://plugins.netbeans.org/plugin/22254/jrebel-netbeans-plugin) and in fact it is compatible with any IDE out there.

This is a great video by Geertjan Wielenga from the NetBeans team that walks through setting up JRebel on NetBeans 7.2.1 and GlassFish 3.1.2:

How to Get Started with JRebel in NetBeans IDE: http://www.youtube.com/watch?v=kveXKv2q4Ec

"Compile on Save" slowed things a lot for me, but another thing I have found out afterwards is the "Apply Code Changes" button in Netbeans, that is only visible in Debug mode. (The green button at the right in the picture)

This is useful to apply Java code changes; it doesn't work each time, but I think it works most of the time if the change is not a method addition and the bean is request scoped. I think this does what Compile on Save manually, but it's better than redeploying.

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