2015-11-21 3 views
8

मैं एक प्ले वेब ऐप को डॉकराइज़ करने की कोशिश कर रहा हूं और मैं एसबीटी-डॉकर का उपयोग कर रहा हूं। जब मैं एसबीटी डोकर निष्पादित मैं gollowing त्रुटि मिलती है:प्ले प्रोजेक्ट में एसबीटी-डॉकर से enablePlugins (DockerPlugin) क्यों देता है "त्रुटि: डॉकरप्लगिन का संदर्भ संदिग्ध है"?

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 
enablePlugins(DockerPlugin) 
      ^
[error] Type error in expression 
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q 

मैं ऊपर त्रुटि मिलती है और मेरे build.sbt इस तरह दिखता है:

enablePlugins(DockerPlugin) 

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

scalaVersion := "2.11.6" 

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

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

// Play provides two styles of routers, one expects its actions to be injected, the 
// other, legacy style, accesses its actions statically. 
routesGenerator := InjectedRoutesGenerator 

// Make docker depend on the package task, which generates a jar file of the application code 
docker <<= docker.dependsOn(sbt.Keys.`package`.in(Compile, packageBin)) 

// Define a Dockerfile 
dockerfile in docker := { 
    val jarFile = artifactPath.in(Compile, packageBin).value 
    val classpath = (managedClasspath in Compile).value 
    val mainclass = mainClass.in(Compile, packageBin).value.getOrElse(sys.error("Expected exactly one main class")) 
    val jarTarget = s"/app/${jarFile.getName}" 
    // Make a colon separated classpath with the JAR file 
    val classpathString = classpath.files.map("/app/" + _.getName).mkString(":") + ":" + jarTarget 
    new Dockerfile { 
    // Base image 
    from("java") 
    // Add all files on the classpath 
    add(classpath.files, "/app/") 
    // Add the JAR file 
    add(jarFile, jarTarget) 
    // On launch run Java with the classpath and the main class 
    entryPoint("java", "-cp", classpathString, mainclass) 
    } 
} 

मेरे संदेह है कि है एसबीटी देशी-बंडल है एसबीटी-डॉकर के साथ विवादित। लेकिन मैं कहीं भी एसबीटी-देशी-पैकर आयात नहीं कर रहा हूं।

उत्तर

1

संदेश कहते हैं "और आयात _root_.com.typesafe.sbt.packager.docker.DockerPlugin" एसबीटी देशी-बंडल विरोधी DockerPlugin वर्ग के साथ आता है। लेकिन यही वह है जो आप पहले ही जानते हैं।

चाल यह है कि प्ले प्लगइन एसबीटी-देशी-पैकर पर निर्भर करता है ... लोगों के जीवन को कम करता है और इसलिए संघर्ष (क्षमा करें, बहुत अधिक मदद लोगों के जीवन को तोड़ सकती है :))।

एक समाधान पूरी तरह से योग्य प्लगइन वर्ग नामों का उपयोग @pfn अनुशंसित या disablePlugins(SbtNativePackager) के रूप में करना है।

http://www.scala-sbt.org/sbt-native-packager/topics/play.html देखें।

10

यदि कोई संघर्ष है तो पूर्ण नाम का उपयोग करें।

enablePlugins(sbtdocker.DockerPlugin) 
संबंधित मुद्दे