java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
Currently I am using Intellij Ultimate 14.0.3, with Scala 1.4 plugin.
I checkout scala-lab from github at https://github.com/scala-labs/scala-labs.git, I have no problem to compile the code using maven 3.2.
But after I import the code into Intellij using "Maven", and try to build the project, I got the following error. The code is using scala-2.11.1, and I don't know why Intellij complains this, but maven command line can compile without any issue. Any idea?
Error:scalac: Error: scala/xml/NamespaceBinding
java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
at com.sksamuel.scapegoat.io.IOUtils$.writeHTMLReport(IOUtils.scala:21)
at com.sksamuel.scapegoat.ScapegoatComponent$$anon$1.run(plugin.scala:55)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481)
at scala.tools.nsc.Global$Run.compile(Global.scala:1582)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:126)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:102)
at xsbt.CompilerInterface.run(CompilerInterface.scala:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:29)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:62)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:20)
at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
Caused by: java.lang.ClassNotFoundException: scala.xml.NamespaceBinding
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 26 more
请先登录再写评论。
It seems that import of maven projects does not handle dependencies of compiler plugins. In this case you have scapegoat plugin, and it needs scala-xml library.
Please follow this issue: https://youtrack.jetbrains.com/issue/SCL-9379
To make compilation work you can remove scapegoat plugin and jvm setting from the pom. If you need scapegoat reports, you can generate them with sbt command.
Thanks.
Disable the scapegoat plugin in the pom.xml does fix this problem. I will follow the issue for a bug fix release.
Thanks