Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

object xml is not a member of package scala

The following code in the compiler:

abstract class query {def get: Unit => scala.xml.Elem}

gives me the error: "object xml is not a member of package scala"

however when I use scala.xml.Elem in sbt through the command line it works just fine,

how do I fix this?

Thanks in advance

like image 424
zunior Avatar asked Jul 03 '14 16:07

zunior


3 Answers

Scala-XML has been factored out into a separate library as of Scala 2.11, so it is not included in Scala projects by default. To include it in your project via sbt add this dependency:

libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
like image 52
Michael Zajac Avatar answered Nov 17 '22 20:11

Michael Zajac


(This is for Windows at least)

In Eclipse go to

Project > Properties

On the windows that appears (should be on Java Build Path on the left) choose the "libraries" section and click on "Add External JARs".

Navigate to your installation folder and then to the "lib" folder (usually

C:\Program Files (x86)\scala\lib

or

C:\Program Files\scala\lib

)

and add

scala-xml_2.11-1.0.2

or whatever version you have.

like image 40
EBM Avatar answered Nov 17 '22 21:11

EBM


Update the dependency

// https://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12
libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6"
like image 4
user5698801 Avatar answered Nov 17 '22 20:11

user5698801