This message was deleted.
# community-support
s
This message was deleted.
t
nvm -
classpath(configurations.runtimeClasspath)
did the trick. 🙌
v
It not really does the trick, it just works-around you not following those instructions properly. 😄 You should revert that and change
implementation("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:
Copy code
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
.
t
oh, thanks! I indeed missed that I had the dependency declaration wrong, my bad! And thanks as well for the compilation part. I was only interested in having a look at the generated Kotlin classes/files at this point. But seeing how the build task wiring would have to be done was helpful nevertheless. 🙏
👌 1