Slackbot
12/25/2023, 8:27 AMTorsten Welches
12/25/2023, 8:58 AMclasspath(configurations.runtimeClasspath) did the trick. 🙌Vampire
12/26/2023, 2:27 AMimplementation("com.cjbooms:fabrikt:+") to fabrikt("com.cjbooms:fabrikt:+") as documented.
Because fabrikt is the configuration you did use as classpath for the generateCode task but you did not add Fabrikt as dependency to it, but added it as implementation dependency which is just majorly wrong as you do not use Fabrikt in your code, just as code generator.
And besides that, you are also only half-following the example code on how to get the generated code resolved. You declare a dependency from the kotlin compilation code to the generation code, but do not declare the generated code as source code.
But actually, that example is bad practice anyway. Instead of declaring paths manually and explit task dependencies, you should wire inputs and output together. So in your case, you would wire the output of the generation task as source files for the source set like this:
kotlin {
val main by sourceSets.existing {
kotlin.srcDir(generateCode)
}
}
then you do not need any explicit dependsOn which are code smell if not having a lifecycle task on the left-hand side and also do not need to configure any explicit paths for the compilation.
And also using tasks.creating is bad practice, as it does not respect task configuration avoidance and should instead be tasks.registering.Torsten Welches
12/26/2023, 5:26 AM