build.sbt中强制依赖更新

时间:2017-02-12 01:08:56

标签: maven sbt updates jfreechart scala-breeze

我正在使用breeze-viz 0.3,但需要使用更新版本的jfreechart。根据依赖表     https://mvnrepository.com/artifact/org.scalanlp/breeze-viz_2.10/0.3

jfreechart 1.0.13是默认版本,但是1.0.19是更新版本,这是我想要的版本。我添加了行

dependencyOverrides ++= Set(
    "org.jfree" % "jfreechart" % "1.0.19"
)

并重新运行sbt eclipse,但我仍然在项目中有jfreedchart 1.0.13。如何强制它使用1.0.19?

这是整个build.sbt

import AssemblyKeys._

name := "Simple Bayesian"

lazy val commonSettings = Seq(
  version := "1.0",
  organization := "com.myco",
  scalaVersion := "2.10.4"
)

val sparkVersion = "2.0.0"
val hbaseVersion = "1.0.0"
val hadoopVersion = "2.4.0"
val sprayVersion      = "1.3.2"

lazy val app = (project in file("."))
  .settings(commonSettings: _*)
  .settings(
    // your settings here
  )

libraryDependencies <<= scalaVersion {
  scala_version => Seq(
    // Spark and Spark Streaming
    "org.apache.spark" %% "spark-core" % sparkVersion,
    "org.apache.spark" %% "spark-mllib" % sparkVersion,
    "org.apache.spark" %% "spark-streaming" % sparkVersion,
    "org.apache.spark" %% "spark-streaming-kinesis-asl" % sparkVersion,
    //"org.scalanlp" %% "breeze" % "0.12",
    //"org.scalanlp" %% "breeze-natives" % "0.12",
    "org.scalanlp" %% "breeze-viz" % "0.3",
    "org.apache.commons" % "commons-lang3" % "3.3.2",  
    "org.apache.commons" % "commons-math3" %"3.2",
    "org.apache.spark" %% "spark-hive" % sparkVersion,
    "commons-lang" % "commons-lang" % "2.6",
    "com.amazonaws" % "aws-java-sdk" % "1.0.002" excludeAll(ExclusionRule(organization = "javax.servlet")),
    "org.json4s" %% "json4s-jackson" % "3.2.10",
    "org.json4s" %% "json4s-native" % "3.2.10",
    "com.amazonaws" % "amazon-kinesis-client" % "1.3.0",
    "com.amazonaws" % "aws-java-sdk" % "1.9.13",
    //"net.sf.opencsv" % "opencsv" % "2.3",
    "log4j" % "log4j" % "1.2.17",
    "io.spray"          %% "spray-json"      % sprayVersion,
    //"gov.sandia.foundry" % "cognitive-foundry" % "3.4.3",
    //"cc.mallet" % "mallet" % "2.0.8",
    "com.github.scopt" %% "scopt" % "3.2.0"% "provided",
    "com.github.kindlychung" % "sfreechart" % "0.1.2", 
    //"ca.umontreal.iro" % "ssj" % "2.5",
    "joda-time" % "joda-time" % "2.3"
  )
}

libraryDependencies += "org.jfree" % "jfreechart" % "1.0.19"

libraryDependencies += "org.biojava" % "jcolorbrewer" % "5.2"

dependencyOverrides ++= Set(
//  "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.4"
    "org.jfree" % "jfreechart" % "1.0.19",
    "org.biojava" % "jcolorbrewer" % "5.2"
)

resolvers += "typesafe repo" at " http://repo.typesafe.com/typesafe/releases/"
resolvers += "jitpack" at "https://jitpack.io"

EclipseKeys.withSource := true

我之前遇到过scala 2.11的问题。我现在应该更新到2.11吗?

1 个答案:

答案 0 :(得分:1)

您看到object StringUtil{ implicit class StringImprovements(s: String) { def quoted = "\""+s+"\"" } } val myStatement = s"INSERT INTO ${tableName.quoted} ..." ,但它是另一个。如果您要查看viz的依赖关系图,您会看到,它取决于jfreedchart 1.0.13,而您希望使用"jfree" % "jfreechart" % "1.0.13",它不会与"org.jfree" % "jfreechart" % "1.0.19"相交前一个,因为他们有不同的 groupId 。所以,你需要添加

libraryDependencies += "org.jfree" % "jfreechart" % "1.0.19"

并通过执行以下操作,从类路径中重复的viz中排除传递依赖项:

libraryDependencies += "org.scalanlp" % "breeze-viz_2.10" % "0.3"  exclude("jfree", "jfreechart") exclude("jfree", "jcommon")

警告,如果1.0.19不向后兼容1.0.13

,这可能会导致问题