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

27th
Aug 2015
Alex Henning Johannessen
@ahjohannessen
Aug 27 2015 12:50

I think I found an issue, not sure if it is sbt-native-packager or just sbt. When I have this setting in my build.sbt:

updateOptions := updateOptions.value.withCachedResolution(false)

I get the following when doing for instance universal:stage or docker:stage:

trace] Stack trace suppressed: run last unemployments/docker:stage for the full output.
[error] (unemployments/docker:stage) Duplicate mappings:
[error]     /Users/ahjohannessen/Development/Work/subsidy/unemployments/target/docker/stage/opt/docker/lib/com.typesafe.config-1.2.1.jar
[error] from
[error]     /Users/ahjohannessen/.ivy2/cache/com.typesafe/config/bundles/config-1.2.1.jar
[error]         /Users/ahjohannessen/.ivy2/cache/com.typesafe/config/jars/config-1.2.1.jar
[error]     /Users/ahjohannessen/Development/Work/subsidy/unemployments/target/docker/stage/opt/docker/lib/io.spray.spray-json_2.11-1.3.1.jar
[error] from
[error]     /Users/ahjohannessen/.ivy2/cache/io.spray/spray-json_2.11/bundles/spray-json_2.11-1.3.1.jar
[error]         /Users/ahjohannessen/.ivy2/cache/io.spray/spray-json_2.11/jars/spray-json_2.11-1.3.1.jar
[error]     /Users/ahjohannessen/Development/Work/subsidy/unemployments/target/docker/stage/opt/docker/lib/io.spray.spray-client_2.11-1.3.2.jar
[error] from
[error]     /Users/ahjohannessen/.ivy2/cache/io.spray/spray-client_2.11/bundles/spray-client_2.11-1.3.2.jar
[error]         /Users/ahjohannessen/.ivy2/cache/io.spray/spray-client_2.11/jars/spray-client_2.11-1.3.2.jar
[error] Total time: 32 s, completed Aug 27, 2015 1:38:42 PM

That error goes away when changing to .withCachedResolution(true) again.

Is there a way that I can turn that off explicitly just when packaging in sbt-native-packager?

Alex Henning Johannessen
@ahjohannessen
Aug 27 2015 13:05
The most interesting part of the stack trace is this:
at scala.sys.package$.error(package.scala:27)
    at sbt.Sync$.noDuplicateTargets(Sync.scala:67)
    at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:25)
    at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:22)
    at com.typesafe.sbt.packager.Stager$.stageFiles(Stager.scala:26)
    at com.typesafe.sbt.packager.Stager$.stage(Stager.scala:40)
    at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$17.apply(DockerPlugin.scala:117)
    at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$17.apply(DockerPlugin.scala:117)
Srepfler Srdan
@schrepfler
Aug 27 2015 13:45
do you guys think there's any benefit of creating some shortcut functions in build.sbt to expose the docker plugin shortcut functions like makeFrom makeMaintainer makeChown ... etc
as they were private I replicated it but that might just be me not digging this simple build tool
Nepomuk Seiler
@muuki88
Aug 27 2015 15:06
@ahjohannessen that's very interesting. Which sbt version are you using? I haven't used the syncing function that often. cc @jsuereth
Nepomuk Seiler
@muuki88
Aug 27 2015 15:18

@schrepfler some settings are used by docker with the Docker scope. Like maintainer in Docker which is used to create the MAINTAINER command.
Others are generated by default. We have only introduced very core docker settings like baseImage and volumes. If you want to do more customization
you can always change the dockerCommands: http://www.scala-sbt.org/sbt-native-packager/formats/docker.html#custom-dockerfile

The reason we don't introduce all docker shortcuts, because docker is moving very fast. And we can't keep up with all the new fancy features or remove the ones not supported anymore. Thus we have a generic data structure that you can always customize no matter what docker does

Alex Henning Johannessen
@ahjohannessen
Aug 27 2015 17:37
@muuki88 0.13.9