1

I have an executable JAR (not a web app being deployed to a standard container like Tomcat, etc.) that needs to connect to a DB and cache a lot of stuff.

If at all possible, I'd like to use the JCache API and inject (via Guice) the Hazelcast implementation. I will code 100% against the JCache API, so that if I ever change my mind and choose another implementation, the swap out should be (relatively) painless.

One problem: where can I get the latest stable JCache JAR?!? (What are the Maven coordinates?)

On Maven Central, all I can find are some dev JARs from 2005! So I ask: where is the JCache?

smeeb
  • 27,777
  • 57
  • 250
  • 447
  • This question is not a dupe, shows research and is ABSOLUTELY on topic. Can someone please explain to me the reasons for both the downvote and closevote (btw, do you know when to use both of those properly)? – smeeb Feb 24 '16 at 19:08
  • [SSCCE](http://sscce.org) – smeeb Feb 24 '16 at 19:23

2 Answers2

3

The jar are available here : javax.cache/cache-api

Jérémie B
  • 10,611
  • 1
  • 26
  • 43
  • Thanks @Jeremie B (+1) - I was searching for "*jcache*" (go figure). How did you find this (just so I know for the future)? – smeeb Feb 24 '16 at 20:21
  • 1
    just search for the package `javax.cache` in maven central : http://search.maven.org/#search%7Cga%7C1%7Cfc%3A%22javax.cache%22 – Jérémie B Feb 24 '16 at 20:22
  • Thanks again (+1) - but how did you know to search for "*javax.cache*" instead of by the APIs logical name "jcache"? – smeeb Feb 24 '16 at 20:23
  • Any thoughts here, @Jeremie B? – smeeb Feb 27 '16 at 10:38
  • all APIs are under the package `javax.cache` – Jérémie B Feb 27 '16 at 10:40
  • Thanks @Jeremie B - but the point of my question was "*how did you know that?* How did you know that all JSR-107 APIs are packaged under `javax.cache`, because I was searching for JSR-107's canonical name `jcache`... – smeeb Feb 28 '16 at 10:50
0

If you want to use Ehcache implementations, copy/past the dependencies below:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.12</version>
</dependency>

<dependency>
    <groupId>javax.cache</groupId>
    <artifactId>cache-api</artifactId>
    <version>1.0.0</version>
</dependency>

<dependency>
    <groupId>org.ehcache</groupId>
    <artifactId>ehcache</artifactId>
    <version>3.1.1</version>
    <scope>runtime</scope>
</dependency>

Find a complete example here.

MDIT
  • 1,508
  • 5
  • 25
  • 38