Ryan Stull Ryan Stull - 1 year ago 89
Scala Question

Can't resolve docker related sbt tags

I'm trying to add sbt-docker to my sbt build of my play website but I'm running into an issue. For some reason none of the docker related stuff on the bottom can resolve.


logLevel := Level.Warn

resolvers ++= Seq(
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.9")


name := "personal_site"

version := "1.1"

lazy val `personal_site` = (project in file(".")).enablePlugins(PlayScala,DockerPlugin)

scalaVersion := "2.11.7"

libraryDependencies ++= Seq( jdbc , cache , ws , specs2 % Test )

unmanagedResourceDirectories in Test <+= baseDirectory ( _ /"target/web/public/test" )

resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"

dockerfile in docker := {
val targetDir = "/usr/src"

new Dockerfile {
//More goes here

imageNames in docker := Seq(
// Sets the latest tag

// Sets a name with a tag that contains the project version
namespace = None,
repository = name.value,
tag = Some("v" + version.value)

Here's an image of what it looks like in IntelliJ

enter image description here

I've also tried adding
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.4.0")
to my
but I get this error about
being imported twice.

~/Sync/Projects/Programming/Personal_Site (master ✘)✹ ᐅ sbt clean
[info] Loading project definition from /home/ryan/Sync/Projects/Programming/Personal_Site/project
/home/ryan/Sync/Projects/Programming/Personal_Site/build.sbt:5: error: reference to DockerPlugin is ambiguous;
it is imported twice in the same scope by
import _root_.sbtdocker.DockerPlugin
and import _root_.com.typesafe.sbt.packager.docker.DockerPlugin
lazy val `personal_site` = (project in file(".")).enablePlugins(PlayScala,DockerPlugin)

Nio Nio
Answer Source

Try changing your build.sbt config to this.

lazy val root = (project in file(".")).enablePlugins(sbtdocker.DockerPlugin, PlayScala)

It removes the ambiguity by using the full name to DockerPlugin, since sbt-native-packager uses the same name for its Docker plugin I believe.

Maybe worth raising a Github issue with the author's repo so they can document it in the project docs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download