0

I try to use slick and squeryl framework for data persistence with scala. I don't want to use Play framework, but just the persistence framework, but when I import slick (or squeryl) jar file, I encountered the issue below:

slick_2.10.1-2.0.0-M1.jar of <project_name> build path is cross-compiled with an incompatible version of Scala (2.10.1). In case this report is mistaken, this check can be disabled in the compiler preference page.   

I used scala jar (2.11.6) under scala plugin on Eclipse, and I can run simple scala application. I can also get access to mysql dbms with jdbc. This problem appears when I import the slick (or squeryl) jar files. Is it because the framework does not support scala 2.11? Is downgrade scala version the solution? If so, can anyone point me a direction on how to downgrade the scala version under Eclipse scala plugin. Thank you very much

Sy Z
  • 441
  • 1
  • 5
  • 10

2 Answers2

1

If you are using scala 2.11 you need to use this dependency for slick:

<dependency>
  <groupId>com.typesafe.slick</groupId>
  <artifactId>slick_2.11</artifactId>
  <version>3.0.0</version>
</dependency>
virtualeyes
  • 11,147
  • 6
  • 56
  • 91
igreenfield
  • 1,618
  • 19
  • 36
1

The previous answer should resolve your issue with slick. If you'd like to use Squeryl, the dependency should be

<dependency>
    <groupId>org.squeryl</groupId>
    <artifactId>squeryl_2.11</artifactId>
    <version>0.9.6-RC3</version>
</dependency>

Or, if you want to use 0.9.5

<dependency>
    <groupId>org.squeryl</groupId>
    <artifactId>squeryl_2.11</artifactId>
    <version>0.9.5-7</version>
</dependency>

Libraries in Scala are only binary compatible with the minor version of Scala they were compiled against. You'll see that in these examples the correct scala version is appended to the artifact ID with an underscore.

If you have the ability to use SBT instead of Maven, I would recommend it. SBT can choose the proper version for you when you reference a dependency like the following

libraryDependencies += "org.squeryl" % "squeryl_2.11" % "0.9.6-RC3"
Dave Whittaker
  • 3,102
  • 13
  • 14