How can I stop NetBeans 8 from deleting generated code at startup?

跟風遠走 提交于 2019-12-11 12:44:35

问题


I have java code generated by Antlr in my NetBeans project. Every time I start NetBeans, it deletes the generated code and forces me to rebuild the project before it can be run. This happens if I do nothing except start NetBeans and then close it after the project finishes loading. How can I tell NetBeans not to delete the generated code at startup? Obviously, I still need to have it regenerate the java code when the Antlr files change that generated it in the first place.


回答1:


I discovered that the unwanted behavior has nothing to do with the NetBeans configuration. The problem was a bug in the way I had declared the "cleanAntlr" task in build.gradle. The task was incorrectly being executed during the initialization and/or configration phases of gradle when the NetBeans IDE first loaded the gradle project, which resulted in the generated java code being deleted at startup. The specific fix is explained in detail at How do I declare gradle Antlr task output specs to avoid unnecessary rebuilds.



来源:https://stackoverflow.com/questions/29802668/how-can-i-stop-netbeans-8-from-deleting-generated-code-at-startup

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