sbt-assembly : 包括测试类 [英] sbt-assembly : including test classes
问题描述
作为 sbt-assembly 的一部分,我想在 jar 中包含 src 和测试类文件.Sbt-assembly 仅包含具有依赖项的 src 文件.有什么方法可以让我在同一个 jar 中也包含测试类?
As part of sbt-assembly I want to include both src and test class files in jar. Sbt-assembly includes only src files with dependencies. Is there any way through which I can include test classes also in same jar?
推荐答案
我编写了 sbt-assembly 以便可以将设置加载到默认 Runtime
之外的其他配置中.将以下内容放在 assembly.sbt
中,它应该添加 test:assembly
任务:
I wrote sbt-assembly so that the settings can be loaded into other configurations than the default Runtime
. Put the following in assembly.sbt
and it should add test:assembly
task:
import AssemblyKeys._
Project.inConfig(Test)(baseAssemblySettings)
jarName in (Test, assembly) := s"${name.value}-test-${version.value}.jar"
就像jarName
设置的作用域一样,将README中的xxx in assembly
替换为xxx in (Test, assembly)
来自定义设置.
Like the way jarName
setting is scoped, substitute xxx in assembly
in README with xxx in (Test, assembly)
to customize the setting.
这篇关于sbt-assembly : 包括测试类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!