我使用的是IntelliJ IDEA v2017.3.2社区版,它似乎不断为Scala插件提供错误的repo版本。
我尝试过设置scalaVersion:=" 2.11.8"在build.sbt和idea.sbt,但它一直试图从2.12插件回购。
我的build.sbt如下:
import sbt.Keys._
import sbt._
import sbtrelease.{Version => SbtVersion}
name := "lambda-geotrellis-tile-server"
resolvers += Resolver.sonatypeRepo("public")
scalaVersion := "2.11.8"
releaseNextVersion := { ver => SbtVersion(ver).map(_.bumpMinor.string).getOrElse("Error") }
lazy val commonSettings = Seq(
organization := "com.jisantuc",
version := "0.0.1",
cancelable in Global := true,
scalaVersion := Version.scala,
scalacOptions := Seq(
"-deprecation",
"-unchecked",
"-feature",
"-language:implicitConversions",
"-language:reflectiveCalls",
"-language:higherKinds",
"-language:postfixOps",
"-language:existentials",
"-language:experimental.macros",
"-feature"
),
shellPrompt := { s => Project.extract(s).currentProject.id + " > " },
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
)
libraryDependencies ++= Seq(
Dependencies.awsJavaCore,
Dependencies.awsJavaEvents,
Dependencies.awsJavaLog4j,
Dependencies.commonsIo,
Dependencies.geotrellisS3,
Dependencies.geotrellisRaster,
Dependencies.geotrellisSpark,
Dependencies.circeCore,
Dependencies.circeGeneric,
Dependencies.circeParser
)
lazy val root = Project("root", file("."))
.settings(resolvers += "LocationTech GeoTrellis Releases" at "https://repo.locationtech.org/content/repositories/geotrellis-releases")
.settings(commonSettings:_*)
assemblyMergeStrategy in assembly := {
case "reference.conf" => MergeStrategy.concat
case "application.conf" => MergeStrategy.concat
case n if n.endsWith(".SF") || n.endsWith(".RSA") || n.endsWith(".DSA") => MergeStrategy.discard
case "META-INF/MANIFEST.MF" => MergeStrategy.discard
case _ => MergeStrategy.first
}
assemblyJarName in assembly := s"lambda-geotrellis-tile-server.jar"
import S3._
s3Settings
mappings in upload := Seq((file(s"target/scala-2.11/${name.value}.jar"), s"${name.value}.jar"))
host in upload := "lambda-geotrellis-tile-server-jar.s3.amazonaws.com"
progress in upload := true
upload <<= upload dependsOn assembly
initialCommands in console := """
|import io.circe.parser._
|import io.circe.syntax._
|import geotrellis.spark.io._
|import geotrellis.spark.io.s3._
""".trim.stripMargin
通过./sbt程序集构建它时工作正常,但是当我尝试在IntelliJ中构建它时,会发生这种情况:
[warn] file:////home/ken/.sbt/preloaded/com/github/gseitz/sbt-release_2.12_1.0/1.0.0/sbt-release-1.0.0.pom
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.github.gseitz/sbt-release/scala_2.12/sbt_1.0/1.0.0/ivys/ivy.xml
[warn] module not found: com.eed3si9n#sbt-assembly;0.14.3
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.3/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.3/ivys/ivy.xml
[warn] ==== local: tried
[warn] /home/ken/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.12_1.0/0.14.3/sbt-assembly-0.14.3.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/ken/.sbt/preloaded/com.eed3si9n/sbt-assembly/0.14.3/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/ken/.sbt/preloaded/com/eed3si9n/sbt-assembly_2.12_1.0/0.14.3/sbt-assembly-0.14.3.pom
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.3/ivys/ivy.xml
[warn] module not found: com.typesafe.sbt#sbt-s3;0.9
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbt/sbt-s3/scala_2.12/sbt_1.0/0.9/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-s3/scala_2.12/sbt_1.0/0.9/ivys/ivy.xml
[warn] ==== local: tried
[warn] /home/ken/.ivy2/local/com.typesafe.sbt/sbt-s3/scala_2.12/sbt_1.0/0.9/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/sbt/sbt-s3_2.12_1.0/0.9/sbt-s3-0.9.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/ken/.sbt/preloaded/com.typesafe.sbt/sbt-s3/0.9/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/ken/.sbt/preloaded/com/typesafe/sbt/sbt-s3_2.12_1.0/0.9/sbt-s3-0.9.pom
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-s3/scala_2.12/sbt_1.0/0.9/ivys/ivy.xml
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.gseitz#sbt-release;1.0.0: not found
[warn] :: com.eed3si9n#sbt-assembly;0.14.3: not found
[warn] :: com.typesafe.sbt#sbt-s3;0.9: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
..即使在尝试再次使用./sbt程序集构建时,这也会成为永久性的。我试着找到2.12的来源,但我没有看到配置文件指定它。
此外,更改idea.sbt中的scalaVersion会导致此错误:
[error] Modules were resolved with conflicting cross-version suffixes in {file:/home/ken/.sbt/1.0/plugins/}global-plugins:
[error] org.scala-lang.modules:scala-xml _2.11, _2.12
[error] org.scala-lang.modules:scala-parser-combinators _2.11, _2.12
[error] java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.modules:scala-parser-combinators
我猜这两个模块是由IntelliJ IDEA使用的吗?