Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Gavin Bisesi
    (multi module project where some stuff is externally-consumed jars and other stuff is applications)
    Gavin Bisesi
    If I set Docker / publishTo := None, will docker:publish stop publishing my jars to my maven repo?
    I have a feeling that setting Docker / publish / skip := true will result in docker:publish not pushing images, correct?
    or would that work
    Gavin Bisesi
    what if I changed the task? Just make a new TaskKey and assign publishTask to it?
    and then I just don't invoke docker:publish
    Julien Blondeau
    Hello, is there any way to customize the systemd ExecStart value ?
    I would like to prefix the executable with an external script that fetches private passwords and inject them into the program environment variables
    Julien Blondeau
    I managed to override the whole systemd unit by creating the file src/templates/systemloader/systemd/start-template is it the right way ?
    Harshvardhan Chauhan
    Hi! docker output in sbt logs is showing up as error level is there a way to fix this?
    Harshvardhan Chauhan
    success] All package validations passed
    [error] #1 [internal] load .dockerignore
    [error] #1 transferring context: 2B done
    [error] #1 DONE 0.0s
    [error] #2 [internal] load build definition from Dockerfile
    [error] #2 transferring dockerfile: 1.49kB done
    [error] #2 DONE 0.0s
    [error] #3 [internal] load metadata for docker.io/library/openjdk:8
    [error] #3 DONE 2.8s
    [error] #4 [stage0 1/9] FROM docker.io/library/openjdk:8@sha256:ffb816515ac0fe5efff...
    [error] #4 DONE 0.0s
    [error] #8 [internal] load build context
    [error] #8 transferring context: 20.41kB done
    [error] #8 DONE 0.0s
    [error] #7 [stage0 2/9] WORKDIR /opt/docker
    [error] #7 CACHED
    [error] #9 [stage0 3/9] COPY opt /opt
    [error] #9 CACHED
    [error] #10 [stage0 4/9] COPY 1/opt /1/opt
    [error] #10 DONE 0.1s
    [error] #11 [stage0 5/9] COPY 2/opt /2/opt
    [error] #11 DONE 0.0s
    [error] #12 [stage0 6/9] RUN ["chmod", "-R", "u=rwX,g=rwX", "/opt/docker"]
    [error] #12 DONE 0.2s
    Sait Sami Kocataş

    hi everyone,

    not sure if it is correct place to post it but I am having an error like below when I try to use fat jar settings

    [info] resolving key references (25390 settings) ...
    [error] Reference to undefined setting:
    [error]   my-module / Universal / mappings from my-module / Universal / mappings (path\to\root\project\Deployment.scala:48)
    [error]         at sbt.internal.util.Init.Uninitialized(Settings.scala:369)
    [error]         at sbt.internal.util.Init.Uninitialized$(Settings.scala:356)
    [error]         at sbt.Def$.Uninitialized(Def.scala:21)
    [error]         at sbt.internal.util.Init.delegate(Settings.scala:263)
    [error]         at sbt.internal.util.Init.delegate$(Settings.scala:239)
    [error]         at sbt.Def$.delegate(Def.scala:21)
    [error]         at sbt.internal.util.Init.compiled(Settings.scala:195)
    [error]         at sbt.internal.util.Init.compiled$(Settings.scala:183)
    [error]         at sbt.Def$.compiled(Def.scala:21)
    [error]         at sbt.internal.util.Init.make(Settings.scala:205)
    [error]         at sbt.internal.util.Init.make$(Settings.scala:200)
    [error]         at sbt.Def$.make(Def.scala:21)
    [error]         at sbt.internal.Load$.$anonfun$apply$5(Load.scala:260)
    [error]         at sbt.internal.Load$.timed(Load.scala:1376)
    [error]         at sbt.internal.Load$.apply(Load.scala:255)
    [error]         at sbt.internal.Load$.defaultLoad(Load.scala:55)
    [error]         at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:847)
    [error]         at sbt.BuiltinCommands$.doLoadProject(Main.scala:847)
    [error]         at sbt.BuiltinCommands$.$anonfun$loadProjectImpl$2(Main.scala:801)
    [error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:149)
    [error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:144)
    [error]         at sbt.Command$.process(Command.scala:187)
    [error]         at sbt.MainLoop$.process$1(MainLoop.scala:199)
    [error]         at sbt.MainLoop$.processCommand(MainLoop.scala:235)
    [error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:147)
    [error]         at sbt.State$StateOpsImpl$.runCmd$1(State.scala:273)
    [error]         at sbt.State$StateOpsImpl$.process$extension(State.scala:277)
    [error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:147)
    [error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
    [error]         at sbt.MainLoop$.next(MainLoop.scala:147)
    [error]         at sbt.MainLoop$.run(MainLoop.scala:138)
    [error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:116)
    [error]         at sbt.io.Using.apply(Using.scala:27)
    [error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:110)
    [error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:65)
    [error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:50)
    [error]         at sbt.MainLoop$.runLogged(MainLoop.scala:41)
    [error]         at sbt.StandardMain$.runManaged(Main.scala:132)
    [error]         at sbt.xMain$.run(Main.scala:67)
    [error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [error]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [error]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    [error]         at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:45)
    [error]         at sbt.xMain.run(Main.scala:39)
    [error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111)
    [error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:130)
    [error]         at xsbt.boot.Launch$.run(Launch.scala:111)
    [error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37)
    [error]         at xsbt.boot.Launch$.launch(Launch.scala:119)
    [error]         at xsbt.boot.Launch$.apply(Launch.scala:20)
    [error]         at xsbt.boot.Boot$.runImpl(Boot.scala:56)
    [error]         at xsbt.boot.Boot$.main(Boot.scala:18)
    [error]         at xsbt.boot.Boot.main(Boot.scala)
    This is more or less what the settings look like, offending code is (mappings in Universal).value . I took this parts from the tutorial directly not sure what is wrong. I am using sbt 1.3.13
      lazy val settings = Seq(
        topLevelDirectory := None,
        javaOptions in Universal ++= Seq("-Dconfig.trace=loads")
      ) ++ dockerSettings ++ assemblySettings
      lazy val dockerSettings = Seq(???)
      lazy val assemblySettings = Seq(
        mappings in (Compile, packageDoc) := Seq(),
        test in assembly := {},
        assemblyJarName in assembly := name.value + ".jar",
        assemblyMergeStrategy in assembly := {
          case PathList("META-INF", xs @ _*) => MergeStrategy.discard
          case "application.conf"            => MergeStrategy.concat
          case x                             => MergeStrategy.first
      ) ++ fatJarSettings
      lazy val fatJarSettings = Seq(
        /*mappings in Universal := {
          val fatJar   = (assembly in Compile).value
          val filtered = (mappings in Universal).value.filter { case (file, name) => !name.endsWith(".jar") }
          filtered :+ (fatJar -> ("lib/" + fatJar.getName))
        scriptClasspath := Seq((assemblyJarName in assembly).value)
    @Deliganli, my guess is that for some reason UniversalPlugin isn't enabled. What plugins do you have enabled in your build.sbt (or in your project/*.scala files)?
    Sait Sami Kocataş
    putting enablePlugins(UniversalPlugin) explicitly in the module actually worked thank you @nigredo-tori . Looks like I got confused
    Leif Warner
    Is there a way to have the generated package make a /var/lib/myPackageName dir, for storing the service's persistence?
    Figure it could be the home dir of the user that it runs as.
    Hi, for a debian package, how can I change the user that is created on the target system? I create two deb files and I want them to use the same user on the target debian machine.
    Ah never mind, I guess I found it in the Java Server Application Manual
    Frank Sauer
    Hi all, I have a multi module build building several docker images. Is it possible to use the image built in one of those as the base image of others? How do I refer to that base image? Thanks!
    Gavin Bisesi

    @fsauer65 I ended up instead making a base image manually with a Dockerfile, and have the projects refer to that.

    But you can set the baseImage per sbt module, I think all you need is the name to match

    only issue might be timing - making sure that the publishLocal for the 'base' image happens first and completes before the following ones begin
    Gavin Bisesi
    How can I make docker:publish not publish jars+poms to my maven repo
    I do jar publishing in a separate step, and I don't want the docker publishing to be involved in it
    Aaron Delaplane
    Does anyone know how to solve the following SSL certificate error. This occurs when I create an interactive shell in a container and run sbt, which triggers the downloads of my project's dependencies:
    https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.7.6/jars/sbt-native-packager.jar: download error: Caught javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.7.6/jars/sbt-native-packager.jar
    Aaron Delaplane
    Is this project still being maintained? I do not see it in the central maven repository
    Gavin Bisesi
    it's maintained, I just think folks generally don't do much support through gitter
    Aaron Delaplane
    Oh, ok. Thanks
    Manu Zhang
    Hi all, is there a way to put conf folder onto java classpath ?

    @manuzhang, I haven't tried this, but I think this should work:

    scriptClasspath += "../conf/"

    Out of interest: what are you trying to achieve? There's probably a way to do that without hijacking the class path.

    Manu Zhang
    I'm trying to read configuration files
    Been there. :smile: You can find the path to your JAR, which should be in the lib/directory, and work from there.
    Or, alternatively, you can keep your config in some place unrelated to your JAR.
    Manu Zhang
    @nigredo-tori thanks, scriptClasspath saves my day
    Nepomuk Seiler
    @AaronDelaplane sbt Plugins mostly live in bintray, so you won't find them on maven central.
    The gitter chat is not my personal favourite. I enabled the GitHub discussions as this seems as a better alternative
    Manu Zhang
    Hi all, it's a bit weird and inconvenient that the working dir of the docker image is owned by "root" rather than the daemon user. Is there a way to change that ?
    I thought eugene changed that a while back
    Gavin Bisesi
    Pretty sure I remember something in the docs about that
    Manu Zhang
    I end up building from a Dockerfile with dockerCommands
    dockerCommands := {
      val buildFile = Source.fromFile("build/Dockerfile")
      val cmds = buildFile.getLines().map { line =>
        val words = line.split(",")
        Cmd(words.head, words.tail: _*)
    Nick Aldwin

    Hi folks. We have sbt-native-packager working great building docker images for several submodules. However, I have a submodule for which I would like to actually build three docker images, with the same contents, except for a change to an environment variable.

    Obviously, I could build another dockerfile that extends the original dockerfile, sets the env var, and republishes, but that would require tacking on some additional docker steps on top of what right now is a very straightforward sbt +releaseEarly.

    Can anyone think of a trivial way to do this? I’m not super familiar with SBT modules, can I make a couple more modules that “extend” the original module, changing just the env vars? Or is there a reasonable way to do this built into the docker plugin of sbt-native-packager?

    Nepomuk Seiler
    I would go for the sub module approach. Basically you could create a commonSettings val that all modules use, override the settings you want per Module.
    custom configurations are non trivial, and changing sbt settings via set ... := is not very obvious IMHO.
    @here sbt native packager now has GitHub discussions, which I encourage you to use. IMHO it provides a better integration and more persistent platform for questions and answers.
    Nick Aldwin
    Oh wow thanks, I had no idea that in didn’t have to correspond to actual files on disk
    Keir Lawson
    Hey, I've got a multi-module build for which I've aggregated a bunch of modules, I want to publish images for sub-modules that have native packager configuration associated with them, however when I try to run docker:publish as root it publishes to docker those projects which have configuration to do so, however for those subprojects that do not it seems to try to run a plain publish step, in my case attempting to upload a jar to bintray, any ideas how I can stop this behaviour?
    Keir Lawson
    Hmmm guess I may have run into sbt/sbt-native-packager#974 ?

    @keirlawson, yeah, the issue here is that Docker/publish falls through to Compile/publish even if DockerPlugin is not enabled. This has to do with how Docker configuration is defined.
    As a quick workaround, you can add a plugin like this:

    object DockerForwardPlugin extends AutoPlugin {
      override requires = DockerPlugin
      override trigger = allRequirements
      object autoImport {
        val forwardedDockerPublish = taskKey[Unit]("Docker/publish for projects with DockerPlugin")
      import autoImport._
      val projectSettings = Seq(
        forwardedDockerPublish := (Docker / publish).value

    , and use forwardedDockerPublish instead. forwardedDockerPublish will only be defined for projects with DockerPlugin.

    Nepomuk Seiler
    Thanks @nigredo-tori . I'll put your answer into the mentioned ticket to persist this workaround.