简体   繁体   English

NetBeans无法正确编译我的Java源代码

[英]NetBeans not correctly compiling my Java sources

I am encountering a problem with NetBeans 7.4 (but also previous versions such as NetBeans 7.3). 我遇到了NetBeans 7.4(还有以前的版本,例如NetBeans 7.3)的问题。 When I clean & build my Java Web application, it gets successfully built, but my newly added code is not included with that build. 当我清理并构建Java Web应用程序时,便成功构建了该应用程序,但是该构建过程中并未包含我新添加的代码。

I confirmed this by decompiling the classes to check whether my changes got through, but they did not. 我通过反编译类来检查我的更改是否通过来确认这一点,但是没有成功。

I have tried different versions of NetBeans to see what happened. 我尝试了不同版本的NetBeans以查看发生了什么。 At one point in time, I also compiled the application through command line using ANT. 在某个时间点,我还使用ANT通过命令行编译了应用程序。 I have also tried deleting the build and dist folders manually. 我也尝试过手动删除build和dist文件夹。 None of these methods solved my issue. 这些方法都不能解决我的问题。

The only, not acceptable solution is that I compile the class individually, then it is ok. 唯一不可接受的解决方案是,我分别编译该类,然后就可以了。 But when I clean and build the whole application, the older sources are compiled. 但是,当我清理并构建整个应用程序时,将编译较旧的源代码。

Looking forward for some help, because I'm really lost, and compiling individually is not an option, since before releasing, I would like to use a single .war file. 期待获得帮助,因为我真的迷路了,并且不能单独编译,因为在发布之前,我想使用一个.war文件。

This issue was a silly mistake. 这个问题是一个愚蠢的错误。 The web part of this project was retrieved by copying the web folder from the server in order to make sure that my team has the latest sources. 通过从服务器复制Web文件夹来检索此项目的Web部分,以确保我的团队拥有最新的资源。 By doing this the class files were being included within the WEB-INF folder, therefore, when attempting to rebuild the application, for some reason, the build was retaking the files within the Web/WEB-INF folder and not generating the classes from the sources. 通过执行此操作,将类文件包含在WEB-INF文件夹中,因此,由于某种原因,当尝试重建应用程序时,该构建会重新获取Web / WEB-INF文件夹中的文件,而不是从Web / WEB-INF文件夹中生成类。资料来源。

When that folder was cleaned up from any class files, the project now builds successfully. 从任何类文件清除了该文件夹后,该项目现在可以成功构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM