java - Netbeans 在保存时部署 : how is it supposed to work?

标签 java jakarta-ee netbeans glassfish

我正在尝试在 Netbeans 中正确设置保存时部署(或保存时编译,或任何我应该设置的)。

我正在努力实现这一目标:

1) 如果结构没有改变,需要时热替换一些类(按下按钮,新代码替换旧代码)

2) 在保存时将我的 jsf 页面 (.xhtml) 复制到 glassfish

1) 大部分时间都有效;有时在我部署很多次之后(为什么?),或者如果 Netbeans 出于某种原因决定它应该部署整个东西(它确实......有时) 2) 在某些项目中工作,在其他项目中不工作

似乎是黑魔法。

它应该如何运作?我似乎无法让 1) 和 2) 同时处理我所有的项目。我应该如何配置它?我一定做错了什么,我只需要知道 list 是什么。

我之前打开过这个:https://netbeans.org/bugzilla/show_bug.cgi?id=218806

更新:这是一个maven项目

最佳答案

Jira 问题的这个更新应该澄清它:

At the moment there are two important features: --> Compile on Save (will be referred as CoS) which basically means that your java files are compiled immediately when you save them (typically to the target/classes).

--> Deploy on Save (will be referred as DoS) is supplementary feature that enables you to deploy your .class file changes to the server immediately when you save them.

So currently you have few possibilities:

1) Turn on both (CoS and DoS) --> That means your changed .java files will be compiled on save and redeployed to the server and also your static resources (html, jsp etc.) will be copied to the server after the save.

2) Turn DoS off but let CoS on --> in such case you will loose everything related to "server refresh". Which means you should have actual class files compiled in the target/classes but you won't see any change in the browser

3) Turn both off --> NB let you to take care of build/deployment

--> It doesn't make semantic sense to have DoS activated while CoS is disabled which is why if you disable CoS, NetBeans automatically disables also DoS

How should I configure that?

所以这里的结论是,你没有做错任何事,你 不能那样配置..NetBeans 只是不支持这样 可能性呢。但好在我现在开始工作了 关于 issue 218345 这正是您所需要的。会有一个新的 名为“Copy static”的复选框(已在 Ant Web 项目中可用) resources on save”,允许您复制 html/jsp/jsf 页面 同时禁用 DoS。

关于java - Netbeans 在保存时部署 : how is it supposed to work?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18451517/

相关文章:

java - Elasticsearch不根据createdBy字段查询?

java - MANIFEST问题-JAR包

java - JTable 使用 JComboBox 填充数据

java - 如何在 UCanAccess 中设置 MS Access 数据库路径?

jakarta-ee - NetBeans 7.1 Java EE 中没有未经检查的警告

java - 完全删除选项卡的标题栏

java - 改进mysql JDBC插入调用

java - Spring 3 依赖注入(inject)

java - 将 EJB 3 部署为单独的项目并通过 Websphere 7 中的 servlet 进行访问

java - 使用 JMS,如何获取特定目标的最大消息大小?