Groovy script startup delay when using HttpBuilder Grape
If you are using Grapes to download dependency at runtime for your groovy script, you can see big delay on script startup.
When you first run script, it makes sense, because Groovy is resolving dependencies and downloading all required jars, but why there is still delay on next launches?
Because some maven artifacts specify that they always want to use the latest version of its dependency X, forcing groovy to check the maven repository for new version of the dependency on each execution.
This happened with HttpBuilder plugin with me. It was taking 30-40 seconds to start and was really annoying.
There is an easy way to solve this. You can specify caching for ify in Grape config file. Create “~/.groovy/grapeConfig.xml” file with following content (~ stands for your home directory):
“ivy.cache.ttl.default” property defines the caching timeout. So you will experience this pause only once in that interval.