NoClassDefFoundError in gradle build

I don’t have a ton experience with gradle, mostly have worked with maven in the past, so a little out of my depth here.

We have a keycloak project that uses gradle. I am making a modification to one of our custom modules here. After adding my new code, I get this error:

08:47:51,137 ERROR [] (default task-1) Uncaught server error: java.lang.NoClassDefFoundError: org/jboss/resteasy/spi/HttpRequest
	at org.keycloak.keycloak-services@19.0.3//org.keycloak.authentication.DefaultAuthenticationFlow.processSingleFlowExecutionModel(

I’ve tried updating my modules gradle build script to include these rest easy libraries:

buildscript {
  repositories {
    maven {
      url ""
  dependencies {
    classpath "io.freefair.gradle:lombok-plugin:6.4.3"
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: "io.freefair.lombok"

defaultTasks 'all'

ext {
  moduleDir = 'modules/system/layers/base/com/company/sso/main'
  moduleBuildDir = file("$imageBuildDir/$moduleDir")

repositories {

dependencies {
  implementation 'org.keycloak:keycloak-core:' + keycloakVersion
  implementation 'org.keycloak:keycloak-services:' + keycloakVersion
  implementation 'org.keycloak:keycloak-server-spi:' + keycloakVersion
  implementation 'org.keycloak:keycloak-server-spi-private:' + keycloakVersion
  implementation 'org.keycloak:keycloak-model-jpa:' + keycloakVersion
  implementation 'commons-io:commons-io:2.4'
  implementation 'commons-lang:commons-lang:2.6'
  implementation "org.hibernate:hibernate-core:$hibernateVersion"
  implementation 'org.jboss.resteasy:resteasy-core:' + resteasyCoreVersion
  implementation 'org.jboss.resteasy:resteasy-core-spi:' + resteasyCoreSpiVersion
  implementation project(':modules:company-keycloak-common')

  testImplementation group: 'junit', name: 'junit', version: junitVersion

  // mandatory dependencies for using Spock
  testImplementation group: 'org.codehaus.groovy', name: 'groovy-all', version: groovyVersion
  testImplementation group: 'org.spockframework', name: 'spock-core', version: spockVersion
  testImplementation group: 'cglib', name: 'cglib-nodep', version: cgLibVersion
  testImplementation group: 'org.objenesis', name: 'objenesis', version: objenesisVersion

jar {
  archiveName = 'company-sso.jar'
tasks.withType(JavaCompile) {
  options.compilerArgs += ['-Xlint:deprecation']

task copyModuleJarFiles(type: Copy) {
  from 'build/libs'
  from configurations.compileClasspath .filter {'spring-security-') ||'spring-core-') ||"dbutils")
  into moduleBuildDir

task all { }

task image { }

all.dependsOn image

I don’t have a lot of knowledge here. This was a previously working setup until I was overriding Keycloak code that referenced the HttpRequest from resteasy. Any help pointing me in the right direction would be appreciated.

Without more information this is just a wild guess,
but I assume your code expects the libraries to be in moduleBuildDir, but you only copy a certain selection of the compile classpath there.
While it should probably better use the runtime classpath, you probably need to add the libs you miss to that filter.