Closed DXsmiley closed 5 years ago
Hi. We use GitHub issue mostly to track bugs and tasks. See https://github.com/sbt/sbt-assembly/blob/master/CONTRIBUTING.md#where-to-file-a-bug-report
Is this problem fixed in a recent release?
@scalahub Note that the link indicates that discussion is redirected to stackoverflow. A query such as sbt-assembly+test will discover related discussion.
I've been looking at stackoverflow questions, but everything looks either old or applies to more complicated cases. I just want to include test bytecode in the jar.
After trial and error, things seems to work with these lines in my sbt file:
settings(inConfig(Test)(baseAssemblySettings)). ... assembly / test := {}, Test / assembly / test := {},
1) Why do I need the first line? What's the difference between 'assembly' and 'test:assembly' without it?
2) How can I combine my 'Test / assembly' and 'assembly' pairs of lines into a single line? (I know it's an sbt scope question...)
Hello. I don't see why this issue is closed, I cannot reproduce a solution. I try adding settings(inConfig(Test)(baseAssemblySettings)
as suggested by @charpov , but to no effect:
$ sbt projects
[info] welcome to sbt 1.6.1 (Debian Java 11.0.14)
...
[info] * lucre2d
[info] rootJS
[info] rootJVM
sbt assembly
[info] welcome to sbt 1.6.1 (Debian Java 11.0.14)
...
[warn] there are 3 keys that are not used by any other settings/tasks:
[warn]
[warn] * ThisBuild / Test / assemblyMergeStrategy
[warn] +- /home/hhrutz/Documents/devel/Lucre2D/build.sbt:70
[warn] +- /home/hhrutz/Documents/devel/Lucre2D/build.sbt:70
[warn] * rootJS / Test / assembly / target
[warn] +- /home/hhrutz/Documents/devel/Lucre2D/build.sbt:69
[warn] * rootJVM / Test / assembly / target
[warn] +- /home/hhrutz/Documents/devel/Lucre2D/build.sbt:69
[warn]
[warn] note: a setting might still be used by a command; to exclude a key from this `lintUnused` check
[warn] either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key
java -cp jvm/Lucre2D.jar de.sciss.lucre.canvas.P5Examples
Error: Could not find or load main class de.sciss.lucre.canvas.P5Examples
Caused by: java.lang.ClassNotFoundException: de.sciss.lucre.canvas.P5Examples
Please advise.
lazy val root = crossProject(JVMPlatform, JSPlatform).in(file("."))
.jvmSettings(commonJvmSettings)
.settings(
name := baseName,
scalaVersion := "2.13.7",
)
.settings(assemblySettings)
// cf. https://github.com/sbt/sbt-assembly/issues/352
.settings(inConfig(Test)(assemblySettings))
Class P5Examples
is in jvm/src/test/scala
.
Same result for sbt test/assembly
, there isn't produced any distinct jar.
I'd like to include my unit tests in the assembled JAR (as well as any test-only dependencies). How do I do this?
The main source for my project is stored in
src/main/scala/project
, and the tests are stored in/src/tests/scala/project
, if that helps.