Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a Scala library that is only available for an older Scala version

I am new to Scala. However, I a created a medium size program with Scala 2.9.0. Now I want to use an open source library which is only available for Scala 2.7.7.

Is it possible to use this 2.7.7 library in my Scala 2.9.0 program? How can I do it? I had already a look at sbt but did not really succeed. Has someone a hello world example for this?

like image 660
Florian Avatar asked Aug 23 '11 18:08

Florian


3 Answers

It should be possible in principle using a custom classloader for the 2.7.7 jar and custom wrappers. But practically, since the library is open source, it's very likely that it would be less work to recompile it with 2.9 and make those changes which are required. (There usually aren't many.)

like image 77
Rex Kerr Avatar answered Nov 16 '22 02:11

Rex Kerr


Typesafe has an early preview of a migration manager (http://typesafe.com/technology/migration-manager) which promises to report on and resolve binary incompatibilities. Apparently the early preview only report on incompatibilities, but it might be worth a shot.

like image 23
thoredge Avatar answered Nov 16 '22 02:11

thoredge


The best approach would be to either use a maintained library or to update the code.

If you take the second option, compile the code with the flags -deprecation and -Xmigration.

This tells you what you need to change between versions.

like image 1
soc Avatar answered Nov 16 '22 00:11

soc