为什么我的 Eclipse 项目构建如此缓慢?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10901636/
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
Why are my Eclipse project builds so slow?
提问by Ken DeLong
We use Eclipse (Indigo, with STS). Certain of our projects take inordinately long to build. Often the progress indicator sticks on, say, 87%, for 30 seconds.
我们使用 Eclipse(Indigo,带 STS)。我们的某些项目需要非常长的时间来构建。通常进度指示器会持续显示 87%,持续 30 秒。
I'm trying to find out what Eclipse is spending it's time on during the build cycle. I hope to be able to optimize the build or disable components that are causing it to be so slow. I'd like to see a log file saying ("compiling java code", "processing resources", etc).
我试图找出 Eclipse 在构建周期中花费的时间。我希望能够优化构建或禁用导致它如此缓慢的组件。我想看到一个日志文件(“编译 java 代码”、“处理资源”等)。
I've poked around the log files in the .metadata directory. I've looked on the Eclipse site for tips. I've tried using "-debug" when starting Eclipse. I still can't find the information I'm looking for.
我浏览了 .metadata 目录中的日志文件。我在 Eclipse 站点上查看了提示。我在启动 Eclipse 时尝试使用“-debug”。我仍然找不到我要找的信息。
Is there any way to get Eclipse to spit out a log of what activities it is spending its time on when it builds a project?
有什么方法可以让 Eclipse 吐出它在构建项目时花费时间的活动的日志?
回答by E-Riz
What kind of projects are these? Java? Dynamic Web? Two things to look at for hints about what's going on are in the project Properties dialog; look at the Builderssection and the Validationsection. Try disabling the validations to see if that makes a difference in your build times.
这些都是些什么项目?爪哇?动态网络?在项目属性对话框中要查看有关正在发生的事情的提示的两件事;查看Builders部分和Validation部分。尝试禁用验证以查看这是否会对您的构建时间产生影响。
To get some insight into what's happening at the times when the build seems to hang, try setting the -debug
and -consoleLog
options, as described here.
为了得到一些见解时生成似乎挂什么在时代发生的事情,尝试设置-debug
和-consoleLog
选项,描述在这里。
回答by user2285658
Disable your virus scanner software for your workspace and project directories. I increased the speed of my build in that way.
为您的工作区和项目目录禁用病毒扫描程序软件。我以这种方式提高了构建速度。
回答by meriton
Since eclipse is a Java application, the usual debugging tools are at your disposal. In particular, you might try connecting to eclipse with JConsole and inspect the thread dump taken when the build "hangs", or run eclipse within a profiler.
由于 eclipse 是一个 Java 应用程序,因此您可以使用常用的调试工具。特别是,您可以尝试使用 JConsole 连接到 eclipse 并检查构建“挂起”时进行的线程转储,或者在分析器中运行 eclipse。
You might find out things like a validator trying to download an xml schema, and waiting for the timeout since eclipse is not configured to use the corpoate proxy server - something which is very hard to find out by other means ;-)
您可能会发现诸如验证器尝试下载 xml 模式并等待超时之类的事情,因为 eclipse 未配置为使用公司代理服务器 - 这是很难通过其他方式找到的东西 ;-)
回答by RTA
You can go to edit Windows->preference->general->workspace->build orderto edit the default that exist according to your project need.
你可以去编辑 Windows->preference->general->workspace->build order来根据你的项目需要编辑存在的默认值。
And check the maximum number of iteration when building with cycle.
并在使用 cycle 构建时检查最大迭代次数。
I hope it works.
我希望它有效。
回答by OpsResearch36
Look into Apache Ant build scripts. Eclipse has support to auto generate them as a starting point instead of coding the whole thing by hand. The shop I worked in used tuned ANT scripts to optimize and control build order. We then piped output to log files using shell scripts.
查看 Apache Ant 构建脚本。Eclipse 支持自动生成它们作为起点,而不是手动编码整个事情。我工作的商店使用经过调整的 ANT 脚本来优化和控制构建顺序。然后我们使用 shell 脚本将输出通过管道传输到日志文件。