Eclipse(带有 J2EE 插件)不会构建类文件到输出目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4541270/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse (with J2EE plugins) will not build class files to output directory
提问by Berlin Brown
I have had this issue with several versions of Eclipse. In some scenarios, Eclipse will not output bytecode class files to the output directory. I will do a build and a clean. I am working with Tomcat server. I stop the server and still Eclipse will not do a build.
我在多个版本的 Eclipse 中都遇到过这个问题。在某些情况下,Eclipse 不会将字节码类文件输出到输出目录。我会做一个构建和清理。我正在使用 Tomcat 服务器。我停止了服务器,但 Eclipse 仍然不会进行构建。
My output directory: project/WebContent/WEB-INF/classes
我的输出目录:project/WebContent/WEB-INF/classes
Sometimes after doing so many builds and/or restarting my machine, I am able to build again to that directory. Does any know what the problem is?
有时在进行了如此多的构建和/或重新启动我的机器之后,我能够再次构建到该目录。有谁知道问题是什么?
Also, what is the best way to create a bug report for this problem.
此外,针对此问题创建错误报告的最佳方法是什么。
Version Info: Galileo Eclipse Java EE IDE for Web Developers. Build id: 20100218-1602
版本信息:Galileo Eclipse Java EE IDE for Web Developers。版本号:20100218-1602
Also, mvn m2eclipse plugin installed.
另外,安装了 mvn m2eclipse 插件。
回答by Ratna Dinakar
This usually happens if, project build path is missing some required libraries. Also ensure, build automatically is checked [ Project > Build Automatically ]. Please post if you still face problem
如果项目构建路径缺少某些必需的库,通常会发生这种情况。还要确保自动构建被选中 [ 项目 > 自动构建 ]。如果您仍然遇到问题,请发布
回答by Vlad
I had the same problem. I had "Build Automatically" checked, and was expecting class file in my project/bin directory but it was empty. What worked for me was unchecking "Build Automatically" in Project menu, Project -> Clean and then do Project -> Build All. Now all .java files were compiled and I checked "Build Automatically" again.
我有同样的问题。我已经选中了“自动构建”,并且在我的项目/bin 目录中期待类文件,但它是空的。对我有用的是取消选中“项目”菜单中的“自动构建”,项目 -> 清理,然后执行项目 -> 全部构建。现在所有 .java 文件都被编译了,我再次检查了“自动构建”。
回答by smallfire
I have another simple question, but I don't know how to comment on the question directly without adding an answer.
我还有一个简单的问题,但我不知道如何在不添加答案的情况下直接对问题发表评论。
Are you running Eclipse/m2eclipse on Windows? If so, you may be having issues with errors occurring during the "clean" lifecycle stage. If you add the following to the <profiles /> element in your ~/.m2/settings.xml, you should be able to avoid this type of build interruption:
你在 Windows 上运行 Eclipse/m2eclipse 吗?如果是这样,您可能会遇到“干净”生命周期阶段发生的错误问题。如果您将以下内容添加到 ~/.m2/settings.xml 中的 <profiles /> 元素,您应该能够避免这种类型的构建中断:
<profile>
<id>windows-nocleanerrors</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<properties>
<maven.clean.failOnError>false</maven.clean.failOnError>
</properties>
</profile>