Search code examples
sbtsbt-assembly

Why does setting (test in assembly) give type error?


I'm using sbt 0.13.8 and sbt-assembly 0.13.0 in a multi-module project. Everything works great until I try to turn off tests during assembly.

As instructed in the docs I add the line

test in assembly := {}

in the settings of one of my modules and get the following error

/Users/lanny/work/IdeaProjects/Search/build.sbt:61: error: type mismatch;
 found   : sbt.TaskKey[sbt.File]
 required: java.io.File
      test in assembly := {},
          ^
sbt.compiler.EvalException: Type error in expression

I'd be happy to show the results of 'inspect test' but alas, I cannot run sbt without removing the line causing the error. Here's what I see with the line removed.

[info] Set current project to search-hadoop (in build file:/Users/lanny/work/IdeaProjects/Search/)
> inspect assembly::test
[info] Task: Unit
[info] Description:
[info]  Executes all tests.
[info] Provided by:
[info]  {file:/Users/lanny/work/IdeaProjects/Search/}hadoop/*:assembly::test
[info] Defined at:
[info]  (sbtassembly.AssemblyPlugin) AssemblyPlugin.scala:32
[info] Dependencies:
[info]  hadoop/test:test
[info] Reverse dependencies:
[info]  hadoop/*:assemblyPackageScala::test
[info]  hadoop/*:assemblyPackageDependency::test
[info]  hadoop/*:assembly
[info] Delegates:
[info]  hadoop/*:assembly::test
[info]  hadoop/*:test
[info]  {.}/*:assembly::test
[info]  {.}/*:test
[info]  */*:assembly::test
[info]  */*:test
[info] Related:
[info]  test/*:assemblyPackageDependency::test
[info]  third_party/test:test
[info]  third_party/*:assemblyPackageDependency::test
[info]  search/*:assembly::test
[info]  search/*:assemblyPackageScala::test
[info]  server/*:assemblyPackageDependency::test
[info]  search/*:assemblyPackageDependency::test
[info]  server/test:test
[info]  hadoop/test:test
[info]  hadoop/*:assemblyPackageScala::test
[info] ...

Solution

  • sbt.Keys.test in assembly := {}
    

    does the trick.