简体   繁体   中英

sbt-onejar and multi-project build

When using oneJar to package a multi project sbt build, project dependencies are not bundled into the jar. My setting is the following:

foo/build.sbt          (top-level build.sbt)
foo/src/               (sources of the root project)
foo/gui/build.sbt      (project 'build' definition)
foo/gui/src            (sources of the 'gui' project)

The build definitions are:

// foo/build.sbt

name := "foo"

version := "0.0.1"

scalaVersion := "2.10.4"

lazy val root = project.in( file(".") )

lazy val gui = project.in( file("gui") ).dependsOn( root )

[...]

//foo/gui/build.sbt

name := "foo-gui"

seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)

[...]

When calling oneJar on the gui project everything seems to run fine, but the classes of the root project are not included in the jar (although the library dependencies are). Is there any fix ?

I never tried a light configuration as you but shouldn't you put the oneJar settings in the root sbt file? You want to package the root and include guy right?

I tried something similar for the first time today and started with oneJar but when using a full sbt configuration the compiler complained that settings were a Seq(_) and sbt expected a single setting or something like that. I switched to sbt-assembly and it worked.

sbt-oneJar has not been updated for 2 years while sbt-assembly was recently updated. I'm not sure which one is preferred but I'd rather use an active tool.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM