Sunday, October 20, 2013

Building the scala-redis client for scala 2.10.3

scala-redis a client for the popular key-value database redis. The client is avaible on github here 
and comes with a jar file 'rediscient-1.0.1.jar for scala version 2.8.1

With a few steps I'll show how to build this client for scala version 2.10.3 using sbt. If you havent done so already clone the repository on github

1. Change two lines in the build.properties:
    build.scala.versions=2.8.1  -> build.scala.versions=2.10.3
    sbt.version=0.7.4 -> sbt.version=0.13.0

The build is for scala 2.10.3 and and the sbt version should match what you have installed. If SBT is not installed you can get it here

2 Open a command line and change directory to the root of your the scala-redis project

3. Type 'sbt'+Enter and wait for dependencies to be resolved
    C:path> sbt

4. Optional: At the SBT prompt type 'compile'+Enter to compile. Wait for success
    > compile

There should be a folder called scala-2.10 in the target folder with compiled java classes.

5. To package the java classes to a jar-file, type 'package'+Enter at the prompt
    > package

There should be a newly created jar file in scala-2.10. My file is named scala-redis_2.10-0.1-SNAPSHOT.jar

Now this jar can be consumed by other projects!





No comments:

Post a Comment