使用 Netbeans、Maven 和 Glassfish 热部署更改 [英] Hot deploying changes with Netbeans, Maven, and Glassfish

查看:23
本文介绍了使用 Netbeans、Maven 和 Glassfish 热部署更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我们从使用 ant 迁移到了 maven.在 Netbeans 中,我曾经在 WAR 中编辑和保存 html、xhtml、javascript、css 文件,并且几乎立即可以在服务器上进行更改.

Recently we migrated from using ant to maven. Within Netbeans, I used to edit and save html, xhtml, javascript, css files in the WAR and almost immediately the changes were available on the server.

现在,当我在 WAR 中编辑和保存这些类型的文件时,没有任何反应.我必须右键单击我的 EAR -> Build with dependencies -> Run 以使更改可用.这个过程需要很长时间.

Now, when I edit and save those types of files in the WAR, nothing happens. I have to right click my EAR -> Build with dependencies -> Run to make the changes available. This process takes ages.

我发现了一些类似的问题,但仍然很困惑.

I've found a few similar questions, but am still confused.

我刚刚擦除了我的开发环境并重新从头开始设置.然后我在同事的机器上复制了设置(他在 Windows 上,我在 Ubuntu 上).使用相同的设置过程,更少的不同操作系统,他可以编辑/保存 xhtml 文件并查看更改,无需额外的步骤!

I just wiped my development environment and setup from scratch again. Then I duplicated the setup on a co-worker's machine (him on Windows, me on Ubuntu). With the same setup process, less different OSs, he can edit/save xhtml files and see the changes without additional steps!

推荐答案

要启用热部署,请启用 Netbeans 中的保存时编译"功能.在您的 POM 中,添加此属性:

To enable hot-deploy, enable the "Compile on Save" feature in Netbeans. In your POM, add this property:

<netbeans.compile.on.save>all</netbeans.compile.on.save>

这个属性会被继承,所以如果你有一个父项目,你可以考虑把它放在那里.

This property will be inherited, so if you have a parent project, you may consider putting it there.

请注意,存在一个错误,其中更改未反映在 UI 中,因此看起来该属性没有影响,但您会注意到热部署有效.

Note that there is a bug in which the change is not reflected in the UI, so it will look like the property has no effect, but you'll notice that hot-deploy works.

这篇关于使用 Netbeans、Maven 和 Glassfish 热部署更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆