Search code examples
scalasbtsbt-assembly

How to override classpath in sbt build project?


I'm using an sbt plugin that reads an embedded resource via

  new InputStreamReader(
    getClass().getResourceAsStream("/%s" format src), utf8
  )

for example

  src = "resources/main.js"

I want to override this resource in the classpath that used by sbt build project itself, to make it using my "resources/main.js" instead of distributed with plugin.jar.


Solution

  • For me helped adding this to build.sbt:

    unmanagedClasspath in Runtime <+= (baseDirectory) map { bd => Attributed.blank(bd / "resources") }
    

    and I put overrided resources to ./resources directory. SBT checked them first.