gleclaire / codenarc-maven-plugin

Maven Mojo Plug-In to generate reports based on the CodeNarc Analyzer
https://gleclaire.github.io/codenarc-maven-plugin/
Apache License 2.0
7 stars 17 forks source link

NoClassDefFoundError error thrown from Maven plugin. #21

Open madelaney opened 6 years ago

madelaney commented 6 years ago

Using Maven (3.5.2), when I try to run the codenarc maven plugin (org.codehaus.mojo:codenarc-maven-plugin:0.22-1) , I get the following stack trace:

     [java] ERROR: org/codehaus/groovy/runtime/BytecodeInterface8
     [java] java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/BytecodeInterface8
     [java]     at org.codenarc.CodeNarc.execute(CodeNarc.groovy:122)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java]     at java.lang.reflect.Method.invoke(Method.java:498)
     [java]     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
     [java]     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:63)
     [java]     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
     [java]     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
     [java]     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
     [java]     at org.codenarc.CodeNarc.main(CodeNarc.groovy:111)
     [java] CodeNarc - static analysis for Groovy',
     [java] Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.BytecodeInterface8
     [java] Usage: java org.codenarc.CodeNarc [OPTIONS]
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
     [java]   where OPTIONS are zero or more command-line options of the form "-NAME[=VALUE]":
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     [java]     -basedir=<DIR>
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
     [java]         The base (root) directory for the source code to be analyzed.
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     [java]         Defaults to the current directory (".").
     [java]     ... 11 more
     [java]     -includes=<PATTERNS>
     [java]         The comma-separated list of Ant-style file patterns specifying files that must
     [java]         be included. Defaults to "**/*.groovy".
     [java]     -excludes=<PATTERNS>
     [java]         The comma-separated list of Ant-style file patterns specifying files that must
     [java]         be excluded. No files are excluded when omitted.
     [java]     -rulesetfiles=<FILENAMES>
     [java]         The path to the Groovy or XML RuleSet definition files, relative to the classpath.
     [java]         This can be a single file path, or multiple paths separated by commas.
     [java]         Defaults to "rulesets/basic.xml"
     [java]     -title=<REPORT TITLE>
     [java]         The title for this analysis; used in the output report(s), if supported by the report type. Optional.
     [java]     -report=<REPORT-TYPE[:FILENAME]>
     [java]         The definition of the report to produce. The option value is of the form
     [java]         TYPE[:FILENAME], where TYPE is "html", "text", "xml", or "console" and FILENAME is the filename (with
     [java]         optional path) of the output report filename. If the report filename is
     [java]         omitted, the default filename is used for the specified report type
     [java]         ("CodeNarcReport.html" for "html" and "CodeNarcXmlReport.xml" for "xml"). If no
     [java]         report option is specified, default to a single "html" report with the
     [java]         default filename.
     [java]     -help
     [java]         Display the command-line help. If present, this must be the only command-line parameter.
     [java]   Example command-line invocations:
     [java]     java org.codenarc.CodeNarc
     [java]     java org.codenarc.CodeNarc -rulesetfiles="rulesets/basic.xml" title="My Project"
     [java]     java org.codenarc.CodeNarc -report=xml:MyXmlReport.xml -report=html
     [java]     java org.codenarc.CodeNarc -help'
     [java] Java Result: 1

I have the plugin configured in my Maven project as such:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>codenarc-maven-plugin</artifactId>
  <version>0.22-1</version>
  <executions>
    <execution>
      <id>code-checks-src</id>
      <phase>verify</phase>
      <goals>
        <goal>codenarc</goal>
      </goals>
      <configuration>
        <sourceDirectory>.</sourceDirectory>
        <codeNarcVersion>1.1</codeNarcVersion>
      </configuration>
    </execution>
  </executions>
</plugin>