Open at-tantv opened 4 years ago
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
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)
Hi, same problem here... JDK 16, Kotlin 1.5.21, Maven, IntelliJ IDEA...
Problem is in KAPT incompatibility with newer versions of JDK https://youtrack.jetbrains.com/issue/KT-45545
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
EDIT
changed dependencies part to:
dependencies {
...
implementation 'org.mapstruct:mapstruct:1.5.0.Beta1'
kapt 'org.mapstruct:mapstruct-processor:1.5.0.Beta1'
kapt 'org.mapstruct:mapstruct-processor:1.5.0.Beta1'
}
And now it works, apologies for the confusion. org.gradle.jvmargs='--illegal-access=permit'
is not required
I built example project Kotlin Gradle but it showed error "class not found exception"