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 [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: java.lang.NoClassDefFoundError: org/jboss/resteasy/spi/HttpRequest
at com.company.sso//com.company.keycloak.sso.authenticator.DynamicIdpRedirectAuthenticator.authenticate(DynamicIdpRedirectAuthenticator.java:51)
at org.keycloak.keycloak-services@19.0.3//org.keycloak.authentication.DefaultAuthenticationFlow.processSingleFlowExecutionModel(DefaultAuthenticationFlow.java:446)
I’ve tried updating my modules gradle build script to include these rest easy libraries:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
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 {
mavenCentral()
}
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 {
it.name.startsWith('spring-security-') ||
it.name.startsWith('spring-core-') ||
it.name.contains("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.