Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt-assembly : including test classes

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?

like image 868
Anuj Mehta Avatar asked Dec 10 '13 07:12

Anuj Mehta


People also ask

Does sbt test compile?

The following commands will make sbt watch for source changes in the Test and Compile (default) configurations respectively and re-run the compile command. Note that because Test / compile depends on Compile / compile , source changes in the main source directory will trigger recompilation of the test sources.

What is sbt assembly?

The sbt-assembly plugin is an SBT plugin for building a single independent fat JAR file with all dependencies included. This is inspired by the popular Maven assembly plugin, which is used to build fat JARs in Maven.

What is sbt test?

The serum bactericidal test (SBT) has been used for almost 40 years to monitor therapy in patients with bacterial endocarditis, osteomyelitis, and other serious infections.


1 Answers

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"

Like the way jarName setting is scoped, substitute xxx in assembly in README with xxx in (Test, assembly) to customize the setting.

like image 190
Eugene Yokota Avatar answered Oct 19 '22 23:10

Eugene Yokota