Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using util.parsing in Scala 2.11

I have written a Scala program with Eclipse Scala IDE that uses scala.util.parsing.JSON and I would like to transform it to support Scala 2.11 version. In Scala 2.11 I get an error: error: object parsing is not a member of package util. I have found out that the parsing library is not anymore in the util package by default, but has to be downloaded separately here.

I have downloaded that and tried to add it to my Eclipse project as a new source folder, but that didn't work out. The instructions are only for adding it to sbt, but I don't think that is relevant to me if I want to just use it in Eclipse.

Should I try to find a JAR file somewhere?

like image 838
Teemu Leivo Avatar asked Nov 01 '14 18:11

Teemu Leivo


1 Answers

Should I try to find a JAR file somewhere?

Yes, you should. :)

And specifically, you should use this one (in SBT syntax):

libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.2"

The above line should be all you need to add to build.sbt if you're using SBT. If you want to manually add it to your project by downloading it, you can find it on Maven Central.

The scala-parser-combinators library was removed in 2.11 so that people who don't use it don't have to pay a price for having it in the scala runtime library. Consequently, people who do want to use it have to now explicitly include it in their build. Note that the XML library was similarly removed in 2.11 to its own library.

like image 100
Reid Spencer Avatar answered Oct 30 '22 21:10

Reid Spencer