Remove all the jars from foo/lib
directory, and insert some dependencies into BuildConfig.groovy:
repositories {
.....
mavenRepo "http://www.terracotta.org/download/reflector/releases"
}
dependencies {
runtime 'net.sf.ehcache:ehcache-core:2.6.2'
runtime 'net.sf.ehcache:ehcache-terracotta:2.6.2'
runtime 'org.terracotta:terracotta-toolkit-1.6-runtime:5.2.0'
}
That will enable automatic download of other necessary jars from the repo and classpath setup.
And, if you setup a open source terracotta server like I did, the enterprise edition foo/lib/ehcache-terracotta-ee-2.6.2.jar will cause an error:
ERROR - An Enterprise client can not connect to an Opensource Server, Connection refused.
The key part:
Run the app with grails -noreloading run-app
instead of grails run-app
to bypass the reloading agent. Then the distributed cache app should be working.
p.s. Deploying the app to production requires no extra work.