These are chat archives for sbt/sbt-native-packager

Aug 2016
Aug 12 2016 08:39

When I run docker:publishLocal in a test-project I get an error saying that opt is not a directory (which it isn't.)

Trying with sbt-native-packager versions 1.1.4 and 1.2.0-M5, here's my build.sbt:

lazy val root ="."))
    scalaVersion := "2.11.8",
    name := "packager-test",
    version := "0.1",
    maintainer := "meg",

    fork in run := true,
    javaOptions += "-Dsecret.message=The proof is in the pudding..."
This is my error message:
> ; clean; docker:publishLocal
[success] Total time: 0 s, completed 2016-aug-12 10:41:43
[info] Sending build context to Docker daemon 2.048 kB
[info] Sending build context to Docker daemon 2.048 kB
[info] Step 0 : FROM java:latest
[info]  ---> bcc5e8d116c9
[info] Step 1 : MAINTAINER meg
[info]  ---> Using cache
[info]  ---> 2c7d62fe2b6d
[info] Step 2 : WORKDIR /opt/docker
[info]  ---> Using cache
[info]  ---> 2abc5718bc9c
[info] Step 3 : ADD opt /opt
[error] opt: no such file or directory
[trace] Stack trace suppressed: run last docker:publishLocal for the full output.
[error] (docker:publishLocal) Nonzero exit value: 1
[error] Total time: 0 s, completed 2016-aug-12 10:41:43
So basically, why does the default build expect an opt-directory? I haven't been able to find any information about this.
Mike Slinn
Aug 12 2016 20:55
Any update on this? @andrewdbate May 20 2015 17:30
Do you know of any way to switch on exportJars just when universal:packageBin is going to be run? Otherwise, with it on all the time, the jars are getting packaged before each test run, and that is very slow.
Nepomuk Seiler
Aug 12 2016 21:10
@megri you need to enable an archetype like JavaAppPackagingPlugin that will set up your application build. The docker plugin will be automatically enabled. If you only enable DockerPlugin you have an empty application.
Nepomuk Seiler
Aug 12 2016 21:18
@mslinn you can bind tasks / settings to other tasks. E.g. exportJars in packageBin := true . Not sure if this works
Mike Slinn
Aug 12 2016 21:29
@muuki88 Good idea. I tried that, and it seemed ok, except that the routes defined in the play subproject were not exported; the other subprojects seemed happy. For that one subproject I wrote exportJars := true, which seems counterintuitive, but I think I have a functioning build.
Mike Slinn
Aug 12 2016 21:35
For dist/conf/application.ini, I know I can specify a Java system variable. Presumably I can specify more than one, and if I do, must they all be on the same line? Where are the contents of this file described?
Nepomuk Seiler
Aug 12 2016 21:39
The application.ini is described in the docs. The recommended way is to use javaOptions in Universal. Native-packager will generate the application.ini and the necessary bashScriptDefines