How to get groovy grape script startup going faster
I've noticed th开发者_如何学Pythonere is like a 10 second hit using a groovy script with Grape annotations on my OSX box. Is it always this way? Can I make grape favor its cache (the depedencies are definitely already on the system in ~/.groovy/grapes...).
Some libraries (notably httpbuilder) use version ranges in their dependencies. There is a post here which describes how to increase the TTL for this version check in your grapeconfig.xml file.
Do you have a ~/.groovy/grapeConfig.xml file defined? The example given in the doco favours the local cache.
<ivysettings>
<settings defaultResolver="downloadGrapes"/>
<resolvers>
<chain name="downloadGrapes">
<filesystem name="cachedGrapes">
<ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
<artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</filesystem>
<!-- todo add 'endorsed groovy extensions' resolver here -->
<ibiblio name="codehaus" root="http://repository.codehaus.org/" m2compatible="true"/>
<ibiblio name="ibiblio" m2compatible="true"/>
<ibiblio name="java.net2" root="http://download.java.net/maven/2/" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
精彩评论