我想在每次保存时编译项目,但在属性中这个选项是灰色的,所以对于任何更改,我必须单击save然后清理并构建。
如何避免为每个代码修改进行清理和构建?
更改netbeans项目的project.properties,如下所示。
您应该从类别中选择源而不是构建。
使用Maven回答Apache NetBeans 10(孵化here)。
配置在nbactions.xml
文件中设置,通常它看起来类似于:
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>war</packaging>
<packaging>ear</packaging>
<packaging>ejb</packaging>
</packagings>
<goals>
<goal>package</goal>
</goals>
</action>
</actions>
要激活Compile On Save
选项,您只需要添加设置为<netbeans.compile.on.save>
的all
,它将如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>war</packaging>
<packaging>ear</packaging>
<packaging>ejb</packaging>
</packagings>
<goals>
<goal>package</goal>
</goals>
<properties>
<netbeans.compile.on.save>all</netbeans.compile.on.save>
</properties>
</action>
</actions>
最新的NB 10和11你可能会在It is recommended to install nb-javac Library to improve Java editing experience and enable compile on save
部分看到警告Notifications
:
您只需要通过单击该链接more info here来安装该插件。