Dynamically load user defined code from plugin?

11 views
Skip to first unread message

Pathikrit Bhowmick

unread,
Nov 20, 2014, 1:26:55 PM11/20/14
to simple-b...@googlegroups.com
Reposted on SO: http://stackoverflow.com/questions/27024934/sbt-plugin-dynamically-load-user-defined-code

I am working on a sbt plugin that generates Scala models given a database using Slick code generator

I would ofcourse want users to override the code generator so my plugin needs to support this:

  • Anyway I can dynamically load a Scala class given a path to it in the build.sbt plugin keys? For example, in the user's parent build.sbt, she would provide something like codegen.override=com.company.project.CustomCodegenerator which looks like this

  • Related to above; the custom codegen may use some other libraries so a simple dynamic class load may not suffice. Anyway an sbt plugin can inherit the dependencies of the project using that plugin?

Here is the full discussion about this: https://github.com/papauschek/play-slick-evolutions-plugin/issues/1


Reply all
Reply to author
Forward
0 new messages