Job-dsl-plugin mvn hpi:run failing to compile project

I’m setting up my plugin development environment to help contribute to Jenkins plugins and have several plugins cloned locally. The plugins are compiling successfully out of the controller branches, however, I’m having trouble compiling the job-dsl plugin GitHub - jenkinsci/job-dsl-plugin: A Groovy DSL for Jenkins Jobs . Job DSL build is failing as below:

[INFO] Reactor Summary for Job DSL Parent 1.94-SNAPSHOT:
[INFO]
[INFO] Job DSL Parent ..................................... SUCCESS [  3.098 s]
[INFO] Job DSL Abstract Syntax Tree (AST) ................. SUCCESS [  2.973 s]
[INFO] Job DSL Core ....................................... SUCCESS [ 12.717 s]
[INFO] Job DSL ............................................ FAILURE [ 52.321 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:17 min
[INFO] Finished at: 2026-02-08T09:01:52-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:4.2.1:generateStubs (default) on project job-dsl: Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: startup failed:
[ERROR] General error during conversion: java.lang.NoClassDefFoundError: Unable to load class javaposse.jobdsl.plugin.DslEnvironment due to missing dependency Context
[ERROR]
[ERROR] java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class javaposse.jobdsl.plugin.DslEnvironment due to missing dependency Context
[ERROR]         at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1123)
[ERROR]         at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1101)
[ERROR]         at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
[ERROR]         at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
[ERROR]         at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
[ERROR]         at org.codehaus.groovy.tools.javac.JavaStubCompilationUnit.compile(JavaStubCompilationUnit.java:93)
[ERROR]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)        
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[ERROR]         at org.codehaus.gmavenplus.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
[ERROR]         at org.codehaus.gmavenplus.mojo.AbstractGenerateStubsMojo.doStubGeneration(AbstractGenerateStubsMojo.java:372)  
[ERROR]         at org.codehaus.gmavenplus.mojo.GenerateStubsMojo.execute(GenerateStubsMojo.java:71)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
[ERROR]         at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:448)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:311)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
[ERROR]         at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)     
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)      
[ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
[ERROR]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)        
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
[ERROR] Caused by: java.lang.NoClassDefFoundError: Unable to load class javaposse.jobdsl.plugin.DslEnvironment due to missing dependency Context
[ERROR]         at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:404)
[ERROR]         at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
[ERROR]         at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:375)
[ERROR]         at org.codehaus.groovy.ast.ClassNode.getAllInterfaces(ClassNode.java:438)
[ERROR]         at org.codehaus.groovy.ast.ClassNode.getAllInterfaces(ClassNode.java:440)
[ERROR]         at org.codehaus.groovy.ast.ClassNode.getAllInterfaces(ClassNode.java:430)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveNestedClass(ResolveVisitor.java:402)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:372)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:340)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:324)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:336)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveGenericsType(ResolveVisitor.java:1464)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveGenericsTypes(ResolveVisitor.java:1416)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:344)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:340)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:324)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:336)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.visitField(ResolveVisitor.java:249)
[ERROR]         at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1073)
[ERROR]         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1345)
[ERROR]         at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:214)
[ERROR]         at org.codehaus.groovy.tools.javac.JavaStubCompilationUnit$1.call(JavaStubCompilationUnit.java:66)
[ERROR]         at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
[ERROR]         ... 42 more
[ERROR]
[ERROR] 1 error
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :job-dsl

AI overview suggest this is potentially an incompatibility issue between Groovy and Java. I could not find any groovy version defined in the pom files so I’m not sure which version I need to align with, however, my environment is setup as below for now.

$ java -version
java version “17.0.16” 2025-07-15 LTSJava™ SE Runtime Environment (build 17.0.16+12-LTS-247)Java HotSpot™ 64-Bit Server VM (build 17.0.16+12-LTS-247, mixed mode, sharing)

$ node -v
v25.3.0

I’ve run mvn clean, mvn clean install with -X and -U flags for debugging and updating dependencies, and have tried troubleshooting steps such as removing the node_modules folders and package-lock.json if there is some issue with the dependencies, but still could not successfully compile.

Please let me know if anyone has any suggestions, thanks.

What maven version are you running?

Since the plugin is built on Java 21 and 25 in CI I would recommend to switch your version as well. We are migrating from Java 17 to Java 21 currently.

Thanks for the quick response. I forgot to list the maven version. I’m using 3.9.9 currently:

$ mvn -version
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: C:\Users\user1\Maven\apache-maven-3.9.9
Java version: 21.0.5, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-21.0.5.11-hotspot
Default locale: en_US, platform encoding: UTF-8OS 
name: “windows 11”, version: “10.0”, arch: “amd64”, family: “windows”

I will try upgrading Java 17 to 21.

Upgrading to Java 21 seems to have resolved the issue.

I’m running mvn hpi:run and Jenkins is started, however, I do not see the “Process Job DSLs” configuration in the freestyle job. Is there a step I am missing?
I don’t see the plugin installed under Plugins either, but I’m not sure if it would show that while just testing the plugin through hpi:run.

Jenkins development generally requires Apache Maven 3.9.11 or 3.9.12.

Thanks, I will also upgrade the Maven version. The compile worked after the Java upgrade to version 21. I’m just having issues now with seeing the plugin on the local Jenkins after running hpi run.

As far as I can tell, the Job DSL plugin won’t run from mvn hpi:run. It doesn’t run for me, at least.

Workaround is to run Jenkins with JENKINS_HOME=work java -jar jenkins.war, complete the setup wizard, then install the released version of the Job DSL plugin. Once that is done, you can exit Jenkins and replace work/plugins/job-dsl.hpi with job-dsl-plugin/target/job-dsl.hpi