SBT Publish local不包含依赖项

时间:2013-12-05 16:14:07

标签: scala sbt spray

我有多个项目A,B,C。有些是实用程序库,有些是应用程序。

如果我有依赖heirarchy A-> B-> C并使用publish-local我必须在A中包含依赖关系B和C两者。即使A不直接从C使用任何东西(仅限代理) 。就好像所有项目B依赖项都添加了提供的范围。

为什么这些依赖关系不会被解析并添加到类路径中?

这不是一个多项目Build.scala(故意)我有几个简化的构建文件,我希望它们是自包含的构建方式。

启动应用程序A时,我正在使用命令重新启动(Revolver)。

/马格努斯


配置示例 在这个例子中,我必须包含多个库(bouncy castle),它们只在以下某个库中使用(所有库都使用publish-local发布)

"mollyware"         %% "fulla-utils"    % fulla,
"mollyware"         %% "brage-http"     % brage,
"mollyware"         %% "saga-domain"    % saga,

连接的build.sbt文件

scalaVersion := "2.10.3"

name := "mimer-idp"

organization := "mollyware"

version := "0.0.1"

import scalariform.formatter.preferences._

net.virtualvoid.sbt.graph.Plugin.graphSettings

// compile options
scalacOptions ++= Seq( 
  "-encoding", 
  "UTF-8", 
  "-optimise", 
  "-deprecation", 
  "-unchecked", 
  "-feature", 
  "-Yinline-warnings" 
)

javacOptions  ++= Seq( 
  "-Xlint:unchecked", 
  "-Xlint:deprecation" 
)

resolvers += Classpaths.typesafeReleases

resolvers ++= Seq(
  "Spray repo" at "http://repo.spray.io",
  "Spray nightlies" at "http://nightlies.spray.io",
  "Sonatype Snapshot Repo" at "http://oss.sonatype.org/content/repositories/snapshots/"
)

scalariformSettings

ScalariformKeys.preferences := FormattingPreferences()
    .setPreference( RewriteArrowSymbols, true )
    .setPreference( AlignParameters, true )
    .setPreference( AlignSingleLineCaseStatements, true )
    .setPreference( SpaceInsideParentheses, true )
    .setPreference( DoubleIndentClassDeclaration, true )
    .setPreference( PreserveDanglingCloseParenthesis, true )

libraryDependencies <<= scalaVersion { scala_version => 
  val akka          = "2.2.1"
  val ampq          = "1.3-SNAPSHOT"
  val spray         = "1.2.0"
  val sprayJson     = "1.2.5"
  val fulla         = "0.0.1"
  val brage         = "0.0.1"
  val saga          = "0.0.1"
  val scalaTest     = "2.0.RC2"
  val commons       = "1.7"
  val bcastle       = "1.49"
  Seq(
    "io.spray"          % "spray-routing"   % spray,
    "io.spray"          % "spray-can"       % spray,
    "io.spray"          % "spray-http"      % spray,
    "io.spray"          % "spray-client"    % spray,
    "io.spray"          % "spray-testkit"   % spray     % "test",
    "io.spray"          %% "spray-json"     % sprayJson,
    "com.typesafe.akka" %% "akka-actor"     % akka,
    "com.typesafe.akka" %% "akka-remote"    % akka,
    "com.github.sstone" %% "amqp-client"    % ampq,
    "mollyware"         %% "fulla-utils"    % fulla,
    "mollyware"         %% "brage-http"     % brage,
    "mollyware"         %% "saga-domain"    % saga,
    "commons-codec"     %  "commons-codec"  % commons,
    "org.scalatest"     %  "scalatest_2.10" % scalaTest % "test",
    "org.bouncycastle"  % "bcprov-jdk15on"  % bcastle,
    "org.bouncycastle"  % "bcpkix-jdk15on"  % bcastle
  )
}

import sbtassembly.Plugin._

import AssemblyKeys._

import spray.revolver.RevolverPlugin._

assemblySettings

assembleArtifact in packageScala := false

assembleArtifact in packageDependency := true

assemblyOption in packageDependency ~= { _.copy(includeScala = false) }

Revolver.settings

1 个答案:

答案 0 :(得分:1)

所以这就出了问题:在我设置CI服务器时,我决定从构建版本中删除-SNAPSHOT

这反过来似乎暗示了publish-local不会使用相同版本更新包。

我花了一段时间才弄明白,因为我前一段时间做了这个改变。这一切的奇怪之处在于,无论如何代码仍然会被更新,因为我找到了类没有找到异常。罐子是否有可能被覆盖而不是常春藤或poms?

我得到了sbt-dependency-graph plugin的帮助,最终弄明白了。没有列出依赖项。当我碰到版本或更改为快照时,它又开始工作了。