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

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

问题描述

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

 欢迎使用Grails 1.3.7  -  http:// grails .org / 
...
解析依赖关系...
9868ms中解析的依赖关系。

以下是我的设置的一些细节:




  • MacBook(OS X 10.5.8)2.4Ghz Core 2 Duo,具有4GB RAM +大量磁盘空间

  • SpringSource Tool Suite - 版本:2.6.1 .RELEASE Build Id:201105041000

  • Grails 1.3.7

  • 只有少数域名型号的小型Grails项目

  • 只需几个插件:hibernate 1.3.7,邮件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目录在我的本地机器上,所以它不是这个问题

  • 我有一些相似的依赖问题到这些,但是我现在已经修复了它们,我没有收到任何错误。

  • 我已经在BuildConfig.groovy中设置了日志记录info 在grails.project.dependency.resolution部分。似乎大部分时间都在解决依赖关系,而不是实际下载项目,所以我不认为mavenCentral或其他公共Maven存储库是一个问题。



从日志中提取

 解决方案报告解决802ms工件dl 86ms 
解决方案报告解析8492ms工件dl 150ms
9909ms中解析的依赖关系。






额外信息:
通过部署我的意思是使用'run-app',通过redeploy我的意思是改变一个强制Grails自动执行'运行应用程序'的文件。我没有任何其他网络相关的性能问题,并且有一个32MB下来,1MB的宽带互联网连接。



对于基准测试,我在过去使用了一个类似大小的应用程序,解决依赖关系耗时大约1秒。该设置是Grails 1.3.6,Shiro安全插件,与Windows XP Service Pack 3机器(Intel Core 2 Duo 2.2Ghz,2GB RAM)上的几个域模型类似的小型项目然后我使用的是NetBeans 6.9.1。 / p>

额外信息2:完整的常春藤日志已附加 here






我每次更改文件很少,所以进行重新部署需要15秒时,这是非常令人沮丧的。



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

解决方案

评论。



如果您确定问题不是您的网络,我知道减少依赖关系解决时间的最佳方式是确保您没有任何快照depende ncies。快照依赖是活动开发中的依赖关系的版本,所以Ivy将需要实际出去外部服务器来检查该快照的新版本是否可用。



我注意到你提到你正在使用webtest 3.0.1 gr ails插件。我知道这个插件取决于两个快照罐。所以删除这个插件应该可以提高依赖关系解析所需的时间。我不知道如何覆盖插件中指定的依赖项。在webtest插件的情况下,我不认为有一个版本的依赖关系是可以接受的,而不是指定的。你可以做的最好的事情是将插件作者删除快照。


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 with 4GB RAM + plenty of disk space
  • SpringSource Tool Suite - Version: 2.6.1.RELEASE Build Id: 201105041000
  • Grails 1.3.7
  • A small Grails project with only a few domain models
  • Just a few plugins: 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

Areas Investigated Already:

  • 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.

Extract from log...

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


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.

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.

Extra Info 2: The full ivy log is attached here


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

Does anyone have any tips on how to reduce the time needed for 'Resolving Dependencies...'?

解决方案

Following up on our conversation in the comments.

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.

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天全站免登陆