You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Maven plugin fails on Java 8 project due to ClassNotFoundException: kotlin.jdk7.AutoCloseableKt #2657
I built UTBotJava-2023.10 using Java 17, after finding that both Java 8 and Java 11 resulted in build failures.
I added the UTBotJava Maven plugin to an open-source project's pom.xml, then tried to use Maven to run the utbot:generateTestsAndSarifReport task. The target project is still based on Java 8, so I set JAVA_HOME to a Java 8 JDK when running Maven. The utbot:generateTestsAndSarifReport task failed, reporting java.lang.ClassNotFoundException: kotlin.jdk7.AutoCloseableKt. Using a Java 17 JDK when running Maven fails even earlier, as the target application does not compile under Java 17.
To Reproduce
Steps to reproduce the behavior:
Build UTBotJava using a Java 17 JDK. In my case, running on MacOS, I used:
If I manually remove ~/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7, then rerun the mvn command described above using a Java 8 JDK, I can see exactly which kotlin-stdlib-jdk7 dependency is being downloaded:
...
[INFO] --- utbot:2023.10-SNAPSHOT:generateTestsAndSarifReport (default-cli) @ soapbox-race ---
Downloading from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.pom (1.4 kB at 3.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.0/kotlin-stdlib-jdk7-1.8.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.0/kotlin-stdlib-jdk7-1.8.0.pom (1.4 kB at 92 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.7.0/kotlin-stdlib-jdk7-1.7.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.7.0/kotlin-stdlib-jdk7-1.7.0.pom (1.4 kB at 99 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.7.20/kotlin-stdlib-jdk7-1.7.20.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.7.20/kotlin-stdlib-jdk7-1.7.20.pom (1.4 kB at 154 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.0/kotlin-stdlib-jdk7-1.8.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.0/kotlin-stdlib-jdk7-1.8.0.jar (963 B at 107 kB/s)
[ERROR] Unexpected error while generating SARIF report
java.lang.NoClassDefFoundError: kotlin/jdk7/AutoCloseableKt
...
Looks like we're getting kotlin-stdlib-jdk7-1.8.0.jar. However, that specific jar does not contain an implementation of kotlin.jdk7.AutoCloseableKt:
Activity
liblit commentedon Oct 10, 2023
Additional clues, perhaps!
If I manually remove
~/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7, then rerun themvncommand described above using a Java 8 JDK, I can see exactly whichkotlin-stdlib-jdk7dependency is being downloaded:Looks like we're getting
kotlin-stdlib-jdk7-1.8.0.jar. However, that specific jar does not contain an implementation ofkotlin.jdk7.AutoCloseableKt:Is the UnitTestBot Maven plugin requesting the wrong version of this
kotlin-stdlib-jdk7dependency?