0

I've noticed there 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...).

M. Justin
  • 14,487
  • 7
  • 91
  • 130
dsummersl
  • 6,588
  • 50
  • 65

2 Answers2

2

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.

mmigdol
  • 2,023
  • 1
  • 18
  • 20
1

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>
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • Yeah thats pretty much what my configuration looks like - except I have a few extra 'ibiblio' references for different repositories down at the bottom. – dsummersl Aug 10 '10 at 19:40
  • 1
    In your groovy script have you declared a dependency on the latest version of a library? In this case Groovy might be checking the internet to determine if there's anything new to download. Finally you could set the property -Dgroovy.grape.autoDownload=false to tell Groovy not to download anything – Mark O'Connor Aug 14 '10 at 11:39