To compile XML syntax, the scala.xml package must be on the classpath

I was creating a servlet using Scala and got the following error message “To compile XML syntax, the scala.xml package must be on the classpath”. It turns out that 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. So the dependency needs to be include in the project build.sbt using the following statement:

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

Note as always you should check that there isn’t a newer version available of the library. How? Google is your friend 🙂

maven org.scala-lang.modules scala-xml

Happy coding!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s