Utilizing Library Dependencies in sbt plugin
<p>I'm working with <a href="http://www.liftweb.net/" rel="nofollow">Lift 3</a> and trying to get <a href="https://flywaydb.org/" rel="nofollow">FlywayDb</a> to work, in order to manage database migrations (via <a href="http://slick.lightbend.com/" rel="nofollow">Slick</a>). There is a Flyway sbt plugin for Slick, <a href="http://blog.ssanj.net/posts/2015-12-18-using-flyway-with-play-2_4-and-slick.html" rel="nofollow">described here</a>. Following those instructions, I have the following in my <code>project/plugins.sbt</code> file:</p>

<pre><code>resolvers += "Flyway" at "https://flywaydb.org/repo"

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.0")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")
addSbtPlugin("org.flywaydb" % "flyway-sbt" % "4.0.3")
</code></pre>

<p>I've also added a <code>flyway.sbt</code> to my project root, but since I am not using TypeSafe's app configuration, but instead using <a href="http://liftweb.net/api/25/api/net/liftweb/util/Props$.html" rel="nofollow">Lift's Props</a>, it looks like this:</p>

<pre><code>import sbt._
import net.liftweb.util.Props

lazy val flywayDBName = "adb"

//Set up local setting key to load configuration into.
lazy val flywayDbConf = settingKey[(String, String, String)]("Lift config file with Slick settings")

flywayDbConf := {
  (Props.get("db.mysql.url"), Props.get("db.mysql.user"), Props.get("db.mysql.password"))
}

flywayUrl := flywayDbConf.value._1

flywayUser := flywayDbConf.value._2

flywayPassword := flywayDbConf.value._3
</code></pre>

<p>This, of course, doesn't work because <code>net.liftweb.util.Props</code> can't be imported - while my <code>build.sbt</code> includes the <code>net.liftweb</code> library dependencies that include <code>net.liftweb.util.*</code> (I know this because I'm using it to access properties in <code>Boot.scala</code> as well as other places), this file does not have access to those dependencies. When executing <code>sbt</code> from the command line:</p>

<pre><code>path/to/project/flyway.sbt:2: error: not found: object net
import net.liftweb.util.Props
       ^
sbt.compiler.EvalException: Type error in expression
</code></pre>

<p>(Incidentally, my IDE also reports the library is not available.)</p>

<p>Clearly, I'm going about this the wrong way. It makes sense that library dependencies aren't available at build time, but the above resources indicate that there should be some way to achieve the same effect. What am I missing? <em>How do I close the gap between the properties file access and the build script?</em></p>

<p>Note that I am attempting to do this so I can manage database changes in the project with FlywayDb, knowing that the underlying db may be either a development (MySQL), production (MySQL or maybe PostGres) or testing (h2) database. I want the code to be agnostic to these details, but all on the same page.</p>