Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
An Infinispan Distributed Cache example written in Groovy script and which will run in the Groovy Console.
@GrabResolver(name='JBoss Release Repository', root='')
@GrabResolver(name=' Maven repository', root='')
@GrabExclude(group = '', module='jboss-jaxrs-api_2.1_spec')
@GrabExclude(group = 'org.jboss.spec.javax.xml.bind', module='jboss-jaxb-api_2.3_spec')
@GrabExclude(group = 'org.jboss.spec.javax.servlet', module='jboss-servlet-api_3.1_spec')
@GrabExclude(group = 'javax.validation', module='validation-api')
@GrabExclude(group = 'org.jboss.spec.javax.annotation', module='jboss-annotations-api_1.2_spec')
@GrabExclude(group = 'net.jcip', module='jcip-annotations')
@GrabExclude(group = 'javax.activation', module='activation')
@GrabExclude(group = 'junit', module='junit')
@Grab(group='org.jboss.logging', module='jboss-logging', version='3.3.0.Final')
@Grab(group='org.slf4j', module='slf4j-api', version='1.7.7.jbossorg-1')
/* Previously we used *only*:
* @Grab(group='org.infinispan', module='infinispan-embedded', version='9.1.7.Final')
* however when we run the script in Ubuntu with Java 15 and Groovy version 3.0.7 the following would appear in the log:
* Mar 28, 2021 10:09:37 PM org.infinispan.factories.GlobalComponentRegistry start
* INFO: ISPN000128: Infinispan version: Infinispan 'Bastille' 9.1.7.Final
* Result: org.infinispan.manager.DefaultCacheManager@25da8465@Address:nullMar 28, 2021 10:09:37 PM org.infinispan.factories.GlobalComponentRegistry lambda$warnAboutUberJarDuplicates$1
* WARN: ISPN000411: Classpath does not look correct. Make sure you are not mixing uber and jars
* 9.1.7.Final was released in March 2018 and is a bit dated at this point however this script below with infinispan-core
* and infinispan-commons (12.0.2.Final) will work in Groovy and without any issues.
@Grab(group='org.infinispan', module='infinispan-core', version='12.0.2.Final')
@Grab(group='org.infinispan', module='infinispan-commons', version='12.0.2.Final')
import org.infinispan.manager.DefaultCacheManager
new DefaultCacheManager()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment