java.lang.NoClassDefFoundError: scala/collection/immutable/Seq

Hello,

Super noob question here, regarding the usage of Scala and XGBoost. So I received a Gradle Scala project from a colleague that is working in production, and I’m trying to run it on my machine. When I try to run, this error appear:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/Serializable
(...)
Caused by: java.lang.ClassNotFoundException: scala.Serializable

I’m relatively new to Scala, but experienced in Java, but I can’t find a good answer to this error online.

This error only happens if there are XGBoost libraries involved, otherwise the project runs fine.

I also should mention that I receive this message when running from vscode using Metals:

2021.12.03 18:11:49 INFO no build target: using presentation compiler with only scala-library: 2.13.5

Gradle settings:

apply plugin: 'scala'
apply plugin: 'java'
apply plugin: 'idea'

idea {
	module {
		inheritOutputDirs = true
		downloadJavadoc = false
		downloadSources = false
	}
}

sourceCompatibility = 1.11
targetCompatibility = 1.11
def scalaVersion = '2.13.5'
def scalaRelease = scalaVersion.split('\\.').take(2).join('.')

repositories {
	mavenCentral()
	maven {url "https://repository.cloudera.com/artifactory/cloudera-repos/"}
}

//def deploy = 'desm'
def deploy = 'prod'

dependencies {
	if (deploy == 'prod') {
		compileOnly "org.scala-lang:scala-library:$scalaVersion"
		compileOnly group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.2'
		compileOnly group: 'com.fasterxml.jackson.module', name: "jackson-module-scala_$scalaRelease", version: '2.11.2'
		compileOnly group: 'org.apache.hbase', name: 'hbase-client', version: '2.1.0-cdh6.3.3'
		compileOnly group: 'org.apache.kafka', name: 'kafka-clients', version: '2.2.1-cdh6.3.3'
	}else if (deploy == 'desm'){
		compile "org.scala-lang:scala-library:$scalaVersion"
		compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.2'
		compile group: 'com.fasterxml.jackson.module', name: "jackson-module-scala_$scalaRelease", version: '2.11.2'
		compile group: 'org.apache.hbase', name: 'hbase-client', version: '2.1.0-cdh6.3.3'
		compile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.2.1-cdh6.3.3'
	}
	compile group: 'ml.dmlc', name: 'xgboost4j', version: '0.72', {
		exclude group: 'com.typesafe.akka', module: 'akka-actor_2.11'
		exclude group: 'com.typesafe.akka', module: 'akka-testkit_2.11'
		exclude group: 'junit', module: 'junit'
		exclude group: 'org.scala-lang', module: 'scala-compiler'
		exclude group: 'org.scala-lang', module: 'scala-reflect'
		exclude group: 'org.scala-lang', module: 'scala-library'
		exclude group: 'org.scalatest',  module: 'scalatest_2.11'
	}
}

JVM: 11.0.13.

Help!