Home > OS >  Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.6.1:generateStubs (groovy) : clas
Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.6.1:generateStubs (groovy) : clas

Time:11-29

I am trying to compile using mvn verify but I am getting the error stated below:

Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.6.1:generateStubs (groovy) on project jenkinsfile-test-shared-library: Error occurred while calling a method on a Groovy class from classpath. InvocationTargetException: startup failed:

[ERROR] General error during conversion: java.lang.NoClassDefFoundError: junit/framework/TestSuite
[ERROR]
[ERROR] java.lang.RuntimeException: java.lang.NoClassDefFoundError: junit/framework/TestSuite
[ERROR] at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1101)
[ERROR] at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1079)
[ERROR] at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
[ERROR] at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
[ERROR] at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
[ERROR] at org.codehaus.groovy.tools.javac.JavaStubCompilationUnit.compile(JavaStubCompilationUnit.java:93)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.gmavenplus.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:275)
[ERROR] at org.codehaus.gmavenplus.mojo.AbstractGenerateStubsMojo.doStubGeneration(AbstractGenerateStubsMojo.java:170)
[ERROR] at org.codehaus.gmavenplus.mojo.GenerateStubsMojo.execute(GenerateStubsMojo.java:72)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

[ERROR] Caused by: java.lang.NoClassDefFoundError: junit/framework/TestSuite
[ERROR] at java.lang.ClassLoader.defineClass1(Native Method)
[ERROR] at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
[ERROR] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[ERROR] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
[ERROR] at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
[ERROR] at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
[ERROR] at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:545)
[ERROR] at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:185)
[ERROR] at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
[ERROR] at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
[ERROR] at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)
[ERROR] at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:313)
[ERROR] at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1236)
[ERROR] at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:176)
[ERROR] at org.codehaus.groovy.tools.javac.JavaStubCompilationUnit$1.call(JavaStubCompilationUnit.java:66)
[ERROR] at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
[ERROR] ... 33 more

[ERROR] Caused by: java.lang.ClassNotFoundException: junit.framework.TestSuite
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[ERROR] ... 55 more
[ERROR]
[ERROR] 1 error

...............................................................

Also specifying my dependency tree:

$ mvn dependency:tree |grep groovy

[INFO] |   - org.kohsuke.stapler:stapler-groovy:jar:1.254:test
[INFO] |  |  \- org.kohsuke:groovy-sandbox:jar:1.10:test
[INFO] |   - com.cloudbees:groovy-cps:jar:1.16:test
[INFO]  - org.codehaus.groovy:groovy-all:jar:2.4.11:compile
[INFO]  - org.spockframework:spock-core:jar:1.1-groovy-2.4:test

CodePudding user response:

Issue fixed. There was a duplicate entry in pom.xml. removing it fixed the problem


Update by kriegaex, copied from a comment by Subhojoy Dey for better readability:

<plugin>
  <groupId>org.codehaus.gmavenplus</groupId>
  <artifactId>gmavenplus-plugin</artifactId>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
</plugin>

This was defined multiple times, deleting this made the issue go. Maybe some version mismatched happened and the error popped up.

  • Related