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
I built example project Kotlin Gradle but it showed error "class not found exception"
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: Cannot find implementation for org.mapstruct.example.kotlin.converter.PersonConverter
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:61)
at org.mapstruct.example.kotlin.MainKt.main(Main.kt:10)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
Caused by: java.lang.ClassNotFoundException: Cannot find implementation for org.mapstruct.example.kotlin.converter.PersonConverter
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:75)
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:58)
... 6 more
I have the same problem using the Mapstruct-Kotlin-Maven example. I use Intellij as IDE.
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: Cannot find implementation for org.mapstruct.example.kotlin.converter.PersonConverter
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:61)
at org.mapstruct.example.kotlin.MainKt.main(Main.kt:10)
Facing the same problem with: JDK 11, Kotlin 1.43.2, MapStruct 1.5.0.Beta1, IntelliJ IDEA
My build.gradle
plugins {
id 'java'
...
id 'org.jetbrains.kotlin.jvm' version "1.4.32"
id 'org.jetbrains.kotlin.plugin.spring' version "1.4.32"
id 'org.jetbrains.kotlin.plugin.jpa' version "1.4.32"
id "org.jetbrains.kotlin.kapt" version "1.4.32"
}
dependencies {
...
implementation 'org.mapstruct:mapstruct:1.5.0.Beta1'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.0.Beta1'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.5.0.Beta1'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "11"
}
}
Tried launching with org.gradle.jvmargs='--illegal-access=permit', result is the same
Activity
filiphr commentedon Jul 5, 2020
Can you please tell us how you are building the project?
Asking because our CI is green. See https://github.com/mapstruct/mapstruct-examples/runs/767089987
Jozott00 commentedon Jul 14, 2021
I have the same problem using the Mapstruct-Kotlin-Maven example. I use Intellij as IDE.
otoman commentedon Jul 28, 2021
Hi, same problem here... JDK 16, Kotlin 1.5.21, Maven, IntelliJ IDEA...
otoman commentedon Jul 29, 2021
Problem is in KAPT incompatibility with newer versions of JDK https://youtrack.jetbrains.com/issue/KT-45545
fire-papaya commentedon Jul 31, 2021
Facing the same problem with: JDK 11, Kotlin 1.43.2, MapStruct 1.5.0.Beta1, IntelliJ IDEA
My
build.gradleTried launching with
org.gradle.jvmargs='--illegal-access=permit', result is the sameEDIT
changed dependencies part to:
And now it works, apologies for the confusion.
org.gradle.jvmargs='--illegal-access=permit'is not required