Grails:部署时间非常慢.“解决依赖关系..."需要 10 多秒 [英] Grails: Very slow deploy time. 'Resolving Dependencies...' takes 10+ seconds

查看:13
本文介绍了Grails:部署时间非常慢.“解决依赖关系..."需要 10 多秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我对 Grails 应用程序进行细微更改时,都需要 10-15 秒来部署它.大部分时间都在解决依赖关系"...

Every time I make a minor change to my Grails app it takes 10-15 seconds to deploy it. The majority of the time is in 'Resolving Dependencies'...

Welcome to Grails 1.3.7 - http://grails.org/
...
Resolving dependencies...
Dependencies resolved in 9868ms.

以下是我的设置的一些详细信息:

Here are some details of my setup:

  • MacBook (OS X 10.5.8) 2.4Ghz Core 2 Duo,4GB RAM + 大量磁盘空间
  • SpringSource 工具套件 - 版本:2.6.1.RELEASE 构建 ID:201105041000
  • Grails 1.3.7
  • 一个只有几个领域模型的小型 Grails 项目
  • 只有几个插件:hibernate 1.3.7、mail 1.0、spring-security-core 1.1.3、spring-security-open id 1.0.2、spring-security-ui 0.1.2、webtest 3.0.1

已经调查的领域:

  • 删除 .ivy2 目录并强制进行完整的外部刷新确实让它下降了大约 5 秒.
  • 我的 .ivy2 目录在我的本地机器上,所以它不是 这个问题
  • 我确实有一些依赖问题,类似于 这些 但是我现在已经修复它们并且我没有收到任何错误.
  • 我通过在 grails.project.dependency.resolution 部分设置日志信息"来打开 BuildConfig.groovy 中的日志记录.它似乎大部分时间都在解决"依赖项而不是实际下载项目,所以我认为 mavenCentral 或其他公共 Maven 存储库不是问题.
  • Deleting the .ivy2 directory and forcing a complete external refresh did bring it down by around 5 seconds.
  • My .ivy2 directory is on my local machine so it's not this problem
  • I did have some dependency problems similar to these however I've now fixed them and I'm not getting any errors.
  • I've turned the logging on in BuildConfig.groovy by setting log "info" in the grails.project.dependency.resolution section. It appears to be spending most of the time 'resolving' the dependencies rather than actually downloading items, so I don't think mavenCentral or other public Maven repositories are a problem.

从日志中提取...

resolution report  resolve 802ms  artifacts dl 86ms
resolution report resolve 8492ms  artifacts dl 150ms
Dependencies resolved in 9909ms.

<小时>

额外信息:部署是指使用运行应用程序",重新部署是指更改强制 Grails 自动执行运行应用程序"的文件.我没有任何其他与网络相关的性能问题,并且有 32MB 的带宽互联网连接和 1MB 的宽带互联网连接.


Extra Info: By deploy I mean using 'run-app', by redeploy I mean changing a file that forces Grails to automaticaly do a 'run-app.' I don't have any other network related performance issues and have a 32MB down, 1MB up broadband internet connection.

对于基准测试,我过去曾开发过一个类似大小的应用程序,其中解决依赖关系"需要大约 1 秒.那个设置是 Grails 1.3.6,Shiro 安全插件,一个类似的小项目,在 Windows XP service Pack 3 机器上有几个域模型(Intel Core 2 Duo 2.2Ghz,2GB RAM)然后我使用 NetBeans 6.9.1.

For benchmarking I have worked on a similarly sized app in the past where the 'Resolving Dependencies' took around 1 second. That setup was Grails 1.3.6, Shiro security plugin, a similarly small project with a few domain models on a Windows XP service Pack 3 machine (Intel Core 2 Duo 2.2Ghz, 2GB RAM) Then I was using NetBeans 6.9.1.

额外信息 2: 附上完整的常春藤日志 这里

Extra Info 2: The full ivy log is attached here

我每次只更改很少的文件,因此重新部署需要 15 秒的时间,这非常令人沮丧.

I'm changing very few files each time so it is extremely frustrating when it takes 15 seconds to do a redeploy.

有没有人有任何关于如何减少解决依赖关系..."所需时间的提示?

推荐答案

在评论中跟进我们的对话.

Following up on our conversation in the comments.

如果您确定问题不是您的网络,我所知道的减少依赖项解析时间的最佳方法是确保您没有任何快照依赖项.快照依赖项是活跃开发中依赖项的版本,因此 Ivy 需要实际到外部服务器检查该快照的新版本是否可用.

The best way that I know of to reduce dependency resolution time if you have determined that the problem is not your network is make sure you don't have any snapshot dependencies. Snapshot dependencies are versions of a dependency in active development, so Ivy will need to actually go out to the external server to check if a new version of that snapshot is available.

我注意到您提到您正在使用 webtest 3.0.1 gr ails 插件.我知道这个插件依赖于两个快照 jar.所以删除这个插件应该可以改善依赖解析所需的时间.我不知道有什么方法可以覆盖插件中指定的依赖项.在 webtest 插件的情况下,我认为除了指定的版本之外,没有可接受的依赖项版本.你能做的最好的事情就是提醒插件作者删除快照.

I noticed that you mentioned that you are using the webtest 3.0.1 gr ails plugin. I know that this plugin depends on two snapshot jars. So removing this plugin should improve the time required for dependency resolution. I don't know of a way to override the dependencies specified in a plugin. In the case of the webtest plugin I don't think that there is a version of the dependency that would be acceptable other than the one specified. The best thing you can do is to nag the plugin author to remove the snapshots.

这篇关于Grails:部署时间非常慢.“解决依赖关系..."需要 10 多秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆