我有这个build.sbt文件,现在不再推荐使用的语法( <<= )。如何更改文件以使其再次工作?我知道有一页记录了这些更改,但我无法正确理解它。
libraryDependencies <<= scalaVersion {
scala_version => Seq(
("org.apache.spark" % "spark-core_2.10" % "1.2.0").
exclude("org.eclipse.jetty.orbit", "javax.mail.glassfish").
exclude("org.eclipse.jetty.orbit", "javax.activation").
exclude("com.esotericsoftware.kryo", "minlog").
exclude("com.esotericsoftware.minlog", "minlog").
exclude("commons-beanutils", "commons-beanutils").
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-logging", "commons-logging").
exclude("org.slf4j", "jcl-over-slf4j").
exclude("org.apache.hadoop", "hadoop-yarn-common").
exclude("org.apache.hadoop", "hadoop-yarn-api").
exclude("org.eclipse.jetty.orbit", "javax.transaction").
exclude("org.eclipse.jetty.orbit", "javax.servlet"),
("org.apache.spark" %% "spark-graphx" % "1.2.0").
exclude("org.eclipse.jetty.orbit", "javax.mail.glassfish").
exclude("org.eclipse.jetty.orbit", "javax.activation").
exclude("com.esotericsoftware.kryo", "minlog").
exclude("com.esotericsoftware.minlog", "minlog").
exclude("commons-beanutils", "commons-beanutils").
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-logging", "commons-logging").
exclude("org.slf4j", "jcl-over-slf4j").
exclude("org.apache.hadoop", "hadoop-yarn-common").
exclude("org.apache.hadoop", "hadoop-yarn-api").
exclude("org.eclipse.jetty.orbit", "javax.transaction").
exclude("org.eclipse.jetty.orbit", "javax.servlet")
)
}发布于 2018-02-20 18:38:13
查看由sbt发出的警告链接到的迁移指南:
[info] Loading global plugins from /.sbt/0.13/plugins
//tmp/build.sbt:3: warning: `<<=` operator is deprecated. Use `key := { x.value }` or `key ~= (old => { newValue })`.
See http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html
libraryDependencies <<= scalaVersion {你可以看到你掉进了最上面的箱子:
使用简单的表达式,例如:
a <<= aTaskDef
b <+= bTaskDef
c <++= cTaskDefs只要用相应的方法取代它们就足够了:
a := aTaskDef.value
b += bTaskDef.value
c ++= cTaskDefs.value所以你的aTaskDef是{}之间的一部分
因此,您可以解决您的问题如下:
scalaVersion := "2.11.7"
libraryDependencies := scalaVersion {
scala_version => Seq(
("org.apache.spark" % "spark-core_2.10" % "1.2.0").
exclude("org.eclipse.jetty.orbit", "javax.mail.glassfish").
exclude("org.eclipse.jetty.orbit", "javax.activation").
exclude("com.esotericsoftware.kryo", "minlog").
exclude("com.esotericsoftware.minlog", "minlog").
exclude("commons-beanutils", "commons-beanutils").
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-logging", "commons-logging").
exclude("org.slf4j", "jcl-over-slf4j").
exclude("org.apache.hadoop", "hadoop-yarn-common").
exclude("org.apache.hadoop", "hadoop-yarn-api").
exclude("org.eclipse.jetty.orbit", "javax.transaction").
exclude("org.eclipse.jetty.orbit", "javax.servlet"),
("org.apache.spark" %% "spark-graphx" % "1.2.0").
exclude("org.eclipse.jetty.orbit", "javax.mail.glassfish").
exclude("org.eclipse.jetty.orbit", "javax.activation").
exclude("com.esotericsoftware.kryo", "minlog").
exclude("com.esotericsoftware.minlog", "minlog").
exclude("commons-beanutils", "commons-beanutils").
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-logging", "commons-logging").
exclude("org.slf4j", "jcl-over-slf4j").
exclude("org.apache.hadoop", "hadoop-yarn-common").
exclude("org.apache.hadoop", "hadoop-yarn-api").
exclude("org.eclipse.jetty.orbit", "javax.transaction").
exclude("org.eclipse.jetty.orbit", "javax.servlet")
)
}.value你在你的问题中说:
但我不能很好地理解。
你到底不明白什么?如果你能详细说明的话,如果这是我能告诉你更多的事情,它可能会帮助任何面临类似问题的人。
https://stackoverflow.com/questions/48891962
复制相似问题