Use Java 1.8 or older. Because the plugin was last released in 2015, and Java 9 was released in 2019, I suspect it doesn't support or handle modules correctly.
I've just tried a simple project and I get the same stacktrace using Java 11, but it passes on Java 1.8. I tried this command line; $ mvn compile org.codehaus.mojo:codenarc-maven-plugin:0.22-1:codenarc Using these files; $ cat pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>1</version> </project> $ cat src/main/java/Example.groovy Console console=System.console(); def name=console.readLine("What is your name? ") println "Welcome to Groovy, $name!" John On Thu, 9 Jul 2020 at 05:44, LINUS FERNANDES <linus.fernan...@gmail.com> wrote: > > Does anyone have a working Maven configuration for CodeNarc for groovy > scripts static analysis? > Much appreciated if you share the same. > > Else, I'll just have to forget about it. > > On Wed, 8 Jul 2020, 12:58 LINUS FERNANDES, <linus.fernan...@gmail.com> > wrote: > > > I tried adding the following dependencies to the plugin : > > > > <dependency> <groupId>org.codehaus. groovy</groupId> > > <artifactId>groovy</ artifactId> > > <version>3.0.4</version> > > </dependency> > > <dependency> <groupId>org.codehaus.groovy</ > > groupId> <artifactId>groovy-all</ > > artifactId> <version>3.0.4</version> > > </dependency> > > > > The first doesn't resolve it and the second fails because : > > > > plugin org.codehaus.mojo:codenarc-maven-plugin:0.22-1 or one of its > > dependencies could not be resolved: Could not find artifact > > org.testng:testng:jar:7.2.0 in central ( > > https://repo.maven.apache.org/maven2) > > > > On Wed, 8 Jul 2020, 12:43 LINUS FERNANDES, <linus.fernan...@gmail.com> > > wrote: > > > >> I'm using Jdk 11. > >> > >> On Wed, 8 Jul 2020, 07:11 LINUS FERNANDES, <linus.fernan...@gmail.com> > >> wrote: > >> > >>> I get the following error for code narc version 0.16 and 0.17 as set in > >>> the configuration. > >>> > >>> > >>> > >>> > >>> ERROR: Unable to make > >>> jdk.internal.loader.ClassLoaders$AppClassLoader(jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.URLClassPath) > >>> accessible: module java.base does not "opens jdk.internal.loader" to > >>> unnamed module @7085bdee > >>> [java] java.lang.reflect.InaccessibleObjectException: Unable to > >>> make > >>> jdk.internal.loader.ClassLoaders$AppClassLoader(jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.URLClassPath) > >>> accessible: module java.base does not "opens jdk.internal.loader" to > >>> unnamed module @7085bdee [java] at > >>> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340) > >>> [java] at > >>> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280) > >>> [java] at > >>> java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:189) > >>> [java] at > >>> java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:182) > >>> [java] at > >>> org.codehaus.groovy.reflection.CachedConstructor$1.run(CachedConstructor.java:41) > >>> [java] at > >>> java.base/java.security.AccessController.doPrivileged(Native Method) > >>> [java] at > >>> org.codehaus.groovy.reflection.CachedConstructor.<init>(CachedConstructor.java:39) > >>> [java] at > >>> org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:73) > >>> [java] at > >>> org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:63) > >>> [java] at > >>> org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) > >>> [java] at > >>> org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) > >>> [java] at > >>> org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:257) > >>> [java] at > >>> groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:192) > >>> [java] at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:196) > >>> [java] at > >>> groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:149) > >>> [java] at > >>> groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:139) > >>> [java] at > >>> groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:122) > >>> [java] at > >>> org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:165) > >>> [java] at > >>> org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:195) > >>> [java] at > >>> org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:214) > >>> [java] at > >>> org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:747) > >>> [java] at > >>> org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:107) > >>> [java] at > >>> org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:148) > >>> [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.util.io.ClassPathResource.getInputStream(ClassPathResource.groovy:59) > >>> [java] at > >>> org.codenarc.util.io.Resource$getInputStream.call(Unknown Source) > >>> [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:120) > >>> [java] CodeNarc - static analysis for > >>> Groovy', [java] Usage: java > >>> org.codenarc.CodeNarc [OPTIONS] > >>> [java] at > >>> org.codenarc.util.io.ClassPathResource.getInputStream(ClassPathResource.groovy:39) > >>> [java] at > >>> org.codenarc.util.io.ClassPathResource$getInputStream.call(Unknown Source) > >>> [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.ruleregistry.PropertiesFileRuleRegistry.loadRules(PropertiesFileRuleRegistry.groovy:52) > >>> [java] at > >>> org.codenarc.ruleregistry.PropertiesFileRuleRegistry.this$2$loadRules(PropertiesFileRuleRegistry.groovy) > >>> [java] where OPTIONS are zero or more command-line options > >>> of > >>> the form "-NAME[=VALUE]": [java] > >>> -basedir=<DIR> [java] at > >>> org.codenarc.ruleregistry.PropertiesFileRuleRegistry$this$2$loadRules.callCurrent(Unknown > >>> Source) [java] The base (root) directory for > >>> the source code to be analyzed. [java] at > >>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44) > >>> [java] Defaults to the current directory > >>> ("."). [java] at > >>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) > >>> > >>> Setting the CodeNarc version to 1.6 throws the following exception > >>> where the plugin can't find a groovy class: > >>> > >>> ERROR: java.lang.NoClassDefFoundError: > >>> org/codehaus/groovy/runtime/BytecodeInterface8 > >>> [java] java.lang.NoClassDefFoundError: > >>> org/codehaus/groovy/runtime/BytecodeInterface8 > >>> [java] at > >>> org.codenarc.CodeNarc.execute(CodeNarc.groovy:158) > >>> [java] at > >>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > >>> Method) [java] at > >>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > >>> [java] at > >>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > >>> [java] at > >>> java.base/java.lang.reflect.Method.invoke(Method.java:566) > >>> [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:147) > >>> [java] Caused by: java.lang.ClassNotFoundException: > >>> org.codehaus.groovy.runtime.BytecodeInterface8 > >>> [java] at > >>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) > >>> [java] at > >>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) > >>> > >>> Additionally, the Github repo at > >>> > >>> https://github.com/gleclaire/codenarc-maven-plugin/ > >>> > >>> has been archived by the owner. > >>> > >>> > >>> > >>> > >>> > >>> On Wed, 8 Jul 2020, 06:24 LINUS FERNANDES, <linus.fernan...@gmail.com> > >>> wrote: > >>> > >>>> That's the original error. I also had issues with the 0.22.x version. > >>>> > >>>> I still am not clear whether I'm referring to the right CodeNarc plugin > >>>> version. > >>>> > >>>> > >>>> > >>>> On Wed, 8 Jul 2020, 00:02 LINUS FERNANDES, <linus.fernan...@gmail.com> > >>>> wrote: > >>>> > >>>>> Ok. Thanks. > >>>>> > >>>>> My mistake, apparently. > >>>>> <plugin> > >>>>> <groupId>org.codenarc</ groupId> > >>>>> <artifactId>CodeNarc</ artifactId> > >>>>> <version>1.6</version> </plugin> > >>>>> > >>>>> I've also had issues with the above. > >>>>> > >>>>> failed to get report for org.codenarc:CodeNarc: Failed to parse > >>>>> plugin descriptor for org.codenarc:CodeNarc:1.6 > >>>>> (/root/.m2/repository/org/codenarc/CodeNarc/1.6/CodeNarc-1.6.jar): No > >>>>> plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1] > >>>>> > >>>>> What's this about? > >>>>> > >>>>> Thanks, > >>>>> Linus. > >>>>> > >>>>> > >>>>> On Tue, 7 Jul 2020, 22:20 Thomas Broyer, <t.bro...@gmail.com> wrote: > >>>>> > >>>>>> This is a Grails plugin, not a Maven plugin. > >>>>>> http://grails.org/plugin/codenarc > >>>>>> > >>>>>> On Tue, Jul 7, 2020 at 5:42 PM LINUS FERNANDES < > >>>>>> linus.fernan...@gmail.com> > >>>>>> wrote: > >>>>>> > >>>>>> > I'm trying to use the following maven plugin to run static code > >>>>>> analysis on > >>>>>> > groovy scripts. > >>>>>> > > >>>>>> > <plugin> > >>>>>> > <groupId>org.grails.plugins</groupId> > >>>>>> > <artifactId>codenarc</artifactId> > >>>>>> > <version>1.6</version> > >>>>>> > </plugin> > >>>>>> > > >>>>>> > I added the plugin repositories as below since it's not hosted on > >>>>>> the > >>>>>> > superPom's repos. > >>>>>> > > >>>>>> > <pluginRepositories> > >>>>>> > <pluginRepository> > >>>>>> > <id>grails-plugins</id> > >>>>>> > <name>Grails Plugins Repository</name> > >>>>>> > <url>https://repo.grails.org/grails/plugins</url> > >>>>>> > </pluginRepository> > >>>>>> > </pluginRepositories> > >>>>>> > > >>>>>> > However, I encounter an error downloading the dependencies since > >>>>>> maven > >>>>>> > expects a codenarc:jar file but a zip file is provided instead. > >>>>>> > > >>>>>> > How do I force Maven to download the zip file instead, preferably > >>>>>> > configuring it within the pom? > >>>>>> > > >>>>>> > > >>>>>> > Regards, > >>>>>> > Linus. > >>>>>> > > >>>>>> > >>>>>> > >>>>>> -- > >>>>>> Thomas Broyer > >>>>>> /tɔ.ma.bʁwa.je/ <http://xn--nna.ma.xn--bwa-xxb.je/> < > >>>>>> http://xn--nna.ma.xn--bwa-xxb.je/> > >>>>>> > >>>>> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org