Search code examples
jedisktor

Implementing Jedis into Ktor build.gradle directly


I am tryng to use Jedis directly in my Ktor application. But I don't know how to implement it in build.gradle file. I tried this:

implementation 'redis.clients:jedis:3.4.0-SNAPSHOT'

But it doesn't work.

val jedis = Jedis("localhost") -> "unresoled reference Jedis" error.

Any help will be appreciated.


Solution

  • This works for me:

    • Put implementation 'redis.clients:jedis:3.4.0' nested under dependencies in the build.gradle file
    • Have your IDE load the gradle changes (Shift-Command-I for IntelliJ Mac)
    • Use import redis.clients.jedis.Jedis at the top of your code file
    • Then you can use the Jedis class just like in your question.

    I tried using what you did, with 'SNAPSHOT' at the end, and it didn't work.