加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – SBT Publish local不包含依赖项

发布时间:2020-12-16 08:43:27 所属栏目:安全 来源:网络整理
导读:我有多个项目A,B,C.有些是实用程序库,有些是应用程序. 如果我具有依赖性heirarchy A- B- C并且使用发布 – 本地,我必须在A中包括依赖关系B和C两者.即使A不直接从C使用任何东西(仅通过代理).就好像所有项目B依赖项都添加了提供的范围. 为什么这些依赖关系不会
我有多个项目A,B,C.有些是实用程序库,有些是应用程序.

如果我具有依赖性heirarchy A-> B-> C并且使用发布 – 本地,我必须在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,"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

解决方法

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

这反过来似乎暗示发布本地不会使用相同版本更新包.

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

我很乐意帮助sbt-dependency-graph plugin最终解决这个问题.没有列出依赖项.当我碰到版本或更改为快照时,它又开始工作了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读