David Smith
05/13/2022, 10:22 AMconfigure<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension> {
jvm {
val main by compilations.getting {
kotlinOptions {
freeCompilerArgs = listOf("-Xallow-result-return-type", "-Xinline-classes")
jvmTarget = JavaVersion.VERSION_11.toString()
javaParameters = true
}
}
}
sourceSets {
val main by getting {
dependencies {
...
configurations["kapt"].dependencies.add(platform("io.micronaut:micronaut-bom:${properties["micronautVersion"]}"))
configurations["kapt"].dependencies.add(project.dependencies.create("io.micronaut:micronaut-inject-java"))
}
}
}
}
however when I run the kaptKotlinJvm
task I’m getting:
java.lang.IllegalArgumentException: The argument does not represent an annotation type: io.micronaut.context.annotation.Replaces
Any idea what I’m missing? What does this error mean, that the dependencies aren’t working or something else?Javier
05/13/2022, 10:37 AMDavid Smith
05/13/2022, 10:39 AMjvmMain
before (based on some example of something on the internet) and it failed because it didn’t exist. SourceSet with name 'jvmMain' not found
src/main/kotlin
etcJavier
05/13/2022, 10:43 AMval
to val jvmMain
it doesnt work?David Smith
05/13/2022, 10:44 AMJavier
05/13/2022, 10:44 AMsourceSets {
val main by getting {
David Smith
05/13/2022, 10:44 AMSourceSet with name 'jvmMain' not found
Javier
05/13/2022, 10:44 AMjvm {}
is not setting it, try to put jvm() too but it is weirdDavid Smith
05/13/2022, 10:46 AMmain
works in that kapt starts, however then I get the The argument does not represent an annotation type
errorsrc/jvmMain
instead?Javier
05/13/2022, 10:48 AMDavid Smith
05/13/2022, 10:49 AMkotlin { jvm {} }
block otherwise the build will fail telling me I need one. Could that be screwing things up?Javier
05/13/2022, 10:51 AMDavid Smith
05/13/2022, 10:51 AMjvm()
and still get SourceSet with name 'jvmMain' not found
Javier
05/13/2022, 10:52 AMDavid Smith
05/13/2022, 10:54 AMJavier
05/13/2022, 10:54 AMDavid Smith
05/13/2022, 10:55 AMScript compilation errors:
Line 33: test {
^ Unresolved reference: test
Line 34: useJUnitPlatform()
^ Unresolved reference: useJUnitPlatform
Line 35: testLogging {
^ Unresolved reference: testLogging
Line 36: exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
^ Unresolved reference: exceptionFormat
Line 37: showStackTraces = false
^ Unresolved reference: showStackTraces
Javier
05/13/2022, 10:55 AMDavid Smith
05/13/2022, 10:56 AMjvm
blockJavier
05/13/2022, 10:57 AMDavid Smith
05/13/2022, 10:59 AMJavier
05/13/2022, 11:00 AMDavid Smith
05/13/2022, 11:01 AMapply false
to the plugin declarations and now I can remove the kotlin
config from the root file, thanks for that at least 🙂ls -l claimant-web-api/src
total 8
drwxr-xr-x 1 vagrant vagrant 128 Nov 27 01:51 jvmMain
drwxr-xr-x 1 vagrant vagrant 96 Nov 27 01:51 test
apply false
but still have the same sourceset not found issue 😭Javier
05/13/2022, 11:18 AMDavid Smith
05/13/2022, 12:13 PMval main
with a source directory named jvmMain
has taken me a little further. I had to add
configure<org.jetbrains.kotlin.gradle.plugin.KaptExtension> {
correctErrorTypes = true
}
and now I have an error during kapt
error: cannot find symbol
@Constraint()
which is a javax library. I have no idea why it can’t find that all of a sudden but it is not directly in my dependenciesval main
but the directory must be called jvmMain
(or I think commonMain
would also work. I also had to add withJava()
into the kotlin config block (I assume because of the way kapt works, it generates java class files).