Scala SBT本地发布不包括依赖项
我有多个项目A,B,C。一些是实用程序库,一些是应用程序 如果我拥有依赖继承权A->B->C并使用publish local,我必须在A中同时包含依赖项B和C。即使A不直接使用C中的任何内容(仅通过代理)。就好像所有项目B依赖项都添加了提供的范围 为什么这些依赖项不会被解析并添加到类路径中 这不是一个多项目Build.scala(故意的)我有几个简化的构建文件,我希望它们是自包含的构建 启动应用程序A时,我正在使用命令“重新启动”(Revolver) /马格纳斯Scala SBT本地发布不包括依赖项,scala,sbt,spray,Scala,Sbt,Spray,我有多个项目A,B,C。一些是实用程序库,一些是应用程序 如果我拥有依赖继承权A->B->C并使用publish local,我必须在A中同时包含依赖项B和C。即使A不直接使用C中的任何内容(仅通过代理)。就好像所有项目B依赖项都添加了提供的范围 为什么这些依赖项不会被解析并添加到类路径中 这不是一个多项目Build.scala(故意的)我有几个简化的构建文件,我希望它们是自包含的构建 启动应用程序A时,我正在使用命令“重新启动”(Revolver) /马格纳斯 示例配置 在本例中,我必须包含
示例配置 在本例中,我必须包含多个库(bouncy castle),这些库只在以下库中使用(所有库都是使用publish local发布的) 连接的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
scalaVersion:=“2.10.3”
名称:=“mimer idp”
组织:=“mollyware”
版本:=“0.0.1”
导入scalariform.formatter.preferences_
net.virtualvoid.sbt.graph.Plugin.graphSettings
//编译选项
scalacOptions++=Seq(
“-编码”,
“UTF-8”,
“-优化”,
“-反对”,
“-未选中”,
“-功能”,
“-银线警告”
)
javacOptions++=Seq(
“-Xlint:未选中”,
“-Xlint:弃用”
)
解析程序+=classpath.typesafeReleases
分解器+++=Seq(
“喷射式回购”在http://repo.spray.io",
“喷洒夜眠”在http://nightlies.spray.io",
“Sonatype快照回购”位于http://oss.sonatype.org/content/repositories/snapshots/"
)
阶梯形设置
ScalariformKeys.preferences:=格式化首选项()
.setPreference(重写箭头符号,真)
.setPreference(AlignParameters,true)
.setPreference(AlignSingleLineCaseStatements,true)
.setPreference(spaceInsideParentHesses,true)
.setPreference(DoubleIndentClassDeclaration,true)
.setPreference(保留悬挂闭合括号,true)
libraryDependencies所以这就是问题所在:在某个时候,当我设置CI服务器时,我决定从构建版本中删除-SNAPSHOT
这反过来似乎暗示,本地发布不会用相同的版本更新包
我花了一段时间才弄明白,因为我不久前就做了那个改变。奇怪的是,自从我得到类not found异常后,代码似乎仍然在更新。有没有可能是罐子被覆盖了,而不是常春藤或POM
最后,我得到了专家们的大力帮助,才明白了这一点。未列出依赖项。当我升级版本或更改为快照时,它又开始工作了。您的问题对于具体发生的情况非常模糊。也许你可以添加一些真实的配置源和日志输出。这是非常模糊的,因为这是一个一般性的问题,与一个特定的包无关。在完成此评论后,我将在上面添加一个示例配置。例如,如果我依赖上面“B”中的spray json,我需要在“A”中包含spray json,否则我会得到类not found异常。它不会包含任何两次删除的依赖项。当我使用publish local时,这似乎是一个问题。因为我没有得到相同的第三方软件包(如果spray json反过来取决于它的工作原理)。
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