GoogleContainerTools / GoogleContainerTools/jib
Scala2 JDK25 MainClassFinder finds the singleton implementation class name(Main$) along with the correct class name(Main)
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Environment**:
- *Jib version:* 3.5.1
- *Build tool:* Gradle: 9.2.1
- *OS:* MacOS 15.7.1
**Description of the issue**:
Projects compiling with Scala 2.13 and Java 25 fail main class inference by discovering both the
`Main$` class and the `Main` class
**Expected behavior**:
jib discovers single `Main` class just like scala 3 or scala 2.13 with JDK 21 or JDK 17
**Steps to reproduce**:
1. Gradle Project with Scala 2.13 and JDK 25
2. `./gradlew jibDockerBuild`
**`jib-gradle-plugin` Configuration**:
```build.gradle.kts
plugins {
scala
id("com.google.cloud.tools.jib")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
scala {
scalaVersion = "2.13.17"
}
```
**Log output**:
```log
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':example-scala2-jdk25-container:jibDockerBuild'.
> com.google.cloud.tools.jib.plugins.common.MainClassInferenceException: Multiple valid main classes were found: example.Main$, example.Main, perhaps you should add a `mainClass` configuration to jib
```
**Additional Information**:
Relevant Code:
https://github.com/GoogleContainerTools/jib/blob/v3.5.1-gradle/jib-core/src/main/java/com/google/cloud/tools/jib/api/MainClassFinder.java#L179-L192
Contributor guide
Assessment
This issue has not been assessed yet.