为什么Scala要寻找SNAPSHOT版本?

时间:2016-10-22 02:51:32

标签: scala sbt akka

我提到了json4s-native 3.3.0但引用了3.3.0-SNAPSHOT。

在我的项目中,有3个模块(通用,读写)都有scala.sbt。

改变之前:

  

“org.json4s”%%“json4s-native”%Versions.Json4s%“编译”,

更改后:(更改了3个模块中的所有位置)

  

“org.json4s”%%“json4s-native”%“3.3.0”%“编译”,

我跑:

  

SBT

     

清洁

     

更新

错误:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.json4s#json4s-native_2.10;3.3.0-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]          org.json4s:json4s-native_2.10:3.3.0-SNAPSHOT

我的销售buld.sbt 是:

name := "myapp-sales"

organization in ThisBuild := "com.mycompany"

scalaVersion in ThisBuild  := "2.11.7"

//crossScalaVersions in Thisq
//Build := List("2.10.5", scalaVersion.value)
//crossPaths := false

scalacOptions in Compile in ThisBuild ++= Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-language:postfixOps", "-language:implicitConVersions")

lazy val common = Project("myapp-sales-common", file("common"))

lazy val read = Project("myapp-sales-read", file("read")).configs(IntegrationTest).settings(Defaults.itSettings: _*).dependsOn(common, write)

lazy val write = Project("myapp-sales-write", file("write")).configs(IntegrationTest).settings(Defaults.itSettings: _*).dependsOn(common)


conflictWarning in ThisBuild := ConflictWarning.disable

parallelExecution in Test in ThisBuild := false

parallelExecution in IntegrationTest in ThisBuild := false

javacOptions in Compile in ThisBuild ++= Seq("-source", "1.6", "-target", "1.6")


//Remove SNAPSHOT check from the release process (for now until Squants gets a release)
releaseProcess := releaseProcess.value.filterNot(_ == ReleaseTransformations.checkSnapshotDependencies)

我的阅读模块 build.sbt

libraryDependencies ++= Seq(
  "com.mycompany"         %% "myapp-core-read"            % myappsales.CoreVersion            % "compile", // disable using the Scala version in output paths and artifacts,
  "com.mycompany"         %% "myapp-core-write"           % myappsales.CoreVersion            % "compile",
  "com.mycompany"         %% "myapp-registration-common"  % myappsales.RegistrationVersion    % "compile",
  "com.mycompany"         %% "myapp-load-common"          % myappsales.LoadVersion            % "compile",
  "com.mycompany"         %% "myapp-core-write-test"      % myappsales.CoreVersion            % "it, test",
  "com.mycompany"         %% "myapp-core-test"            % myappsales.CoreVersion            % "it, test"
)

libraryDependencies ++= Seq(
  "com.typesafe"               % "config"                                % myappsales.TypeSafeConfigVersion % "compile",
  "org.json4s"                 %% "json4s-native"                         % Versions.Json4s         % "compile",
  "io.spray"                    % "spray-routing"                         % Versions.Spray          % "compile",
  "com.typesafe.akka"          %% "akka-actor"                            % Versions.Akka           % "compile",
  "com.typesafe.akka"          %% "akka-remote"                           % Versions.Akka           % "compile"
    exclude ("io.netty", "netty")
)

//Assemby settings
test in assembly := {}
assemblyShadeRules in assembly := Seq(
  ShadeRule.rename("play.api.libs.iteratee.**" -> "shade.play.api.libs.iteratee.@1")
    .inLibrary("play" % "play-iteratees_2.10" % "2.1-RC2")
    .inLibrary("org.reactivemongo" % "reactivemongo_2.10" % "0.8.1-SNAPSHOT"),
  ShadeRule.rename("scala.concurrent.stm.**" -> "shade.scala.concurrent.stm.@1")
    .inLibrary("org.scala-stm" % "scala-stm_2.10.0" % "0.6")
    .inLibrary("play" % "play-iteratees_2.10" % "2.1-RC2")
)

assemblyMergeStrategy in assembly := {
  case "application.conf" => MergeStrategy.concat
  case path => MergeStrategy.defaultMergeStrategy(path)
}

//Make assembly a publishable artifact
artifact in (
  Compile, assembly) := {
  val art = (artifact in (Compile, assembly)).value
  art.copy(`classifier` = Some("assembly"))
}

addArtifact(artifact in (Compile, assembly), assembly)

为什么还在寻找SNAPSHOT版本?

1 个答案:

答案 0 :(得分:4)

这是调查此类问题的一种相当标准的方法。在 plugins.sbt

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")

然后转到sbt dependencyBrowseGraph,这将打开您的浏览器并转到一个页面,其中可以浏览包括被驱逐者在内的整个依赖关系图。现在找出SNAPSHOT来自哪里,并排除它。