Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ build fails with java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding #218

Open
Normanator opened this issue Nov 14, 2018 · 4 comments

Comments

@Normanator
Copy link

I had to modify the Maven integration steps from the README. I'd added the compilerPlugin under the org.scala-tools maven-scala-plugin, 2.15.2. This works fine from Maven compile commands, but fails IntelliJ Builds.

Error:scalac: Error: scala/xml/NamespaceBinding
java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
at com.sksamuel.scapegoat.io.IOUtils$.writeHTMLReport(IOUtils.scala:24)

This seems to be the issue Martin Ford described 23 Feb 2015 (resolved "Won't Fix") and in this other Jetbrains issue. The former's workaround escapes me. The latter's is … self-defeating.

I would assume ideally I'd tell the build's VM to use the scala-xml.jar located within my .IdeaIC2018.2\config\plugins\Scala\lib, checked-in to git for others no matter where there vintage of IntelliJ actually puts the scala plugins.

Could the missing step be added to the README?

@JoshRosen
Copy link
Contributor

Cross-reference (for easier discoverability): this is related to #98.

@JoshRosen
Copy link
Contributor

JoshRosen commented Nov 19, 2018

Another workaround: if you don't actually need / want XML reports, pass the -P:scapegoat:reports:none compiler flag to disable all report generation. This seems to bypass the parts of the code which use Scala XML.

See https://github.com/sksamuel/scapegoat/blob/c7e566629b001e87fc1354f6c194d494d30c1b7f/src/main/scala/com/sksamuel/scapegoat/plugin.scala#L43

@sengopal
Copy link

sengopal commented May 9, 2019

Another workaround to get both the reports and still compile in Intellij is to use a dynamic property for Maven.

Add a property to pom.xml
<scapegoat.report>none</scapegoat.report>

Use the property in the scapegoat arg

<configuration>
    <args>
        <arg>-P:scapegoat:reports:${scapegoat.report}</arg>
   </args>
</configuration>

Generate reports via Maven using
-Dscapegoat.report=html clean install

@opensorceror
Copy link

^ The above workaround seems to work with scala-maven-plugin v3.0.2, but doesn't work with v4.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants