how to disable slick codegen from creating dbModels on each compile?

244 views Asked by At

I tried to comment automatic code gen on each compile in Build.scala as below,but then it my code shows error as it is unable to reference any autogen table models from previous compilations.

 slick <<= slickCodeGenTask // register manual sbt command
 //sourceGenerators in Compile <+= slickCodeGenTask // register automatic code  generation on every compile, remove for only manual use
1

There are 1 answers

0
Ossip On

this worked for me: after running the task in sbt (gen-tables) just copy the generated Tables.scala into your source tree, so it will be picked up \as "normal" source file.

Or you can also modify the output directory in slickCodeGenTask to point into your sources, something like:

val outputDir = "src/main/scala"

hope this helps!