开发者

Grails: Very slow deploy time. 'Resolving Dependencies...' takes 10+ seconds

开发者 https://www.devze.com 2023-03-11 07:25 出处:网络
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\'...

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 sma开发者_高级运维ll 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.


Just found out (through asking) that you can use a local repository to resolve your snapshot dependencies. This could be faster than over the network:

Grails: working offline with snapshot dependencies


Please see my answer here. A plugin relying on a poorly defined maven artifact can cause grails to go and look every time for a newer version.

Grails very slow to resolve certain dependencies

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号