您好我有5个jar文件,并尝试使用sbt将它们发布到本地存储库.但是当我将它们放在unmanagedBase目录中时就像lib/它们不会被复制一样publishLocal.有没有简单的方法将它们包含在发布过程中?
目前maven在这里有一个类似的解决方案:http: //maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
一种选择是为要发布的每个 jar 定义一个子项目。让您的主要项目依赖于每个项目。为每个子项目指定适当的name、version和organization。对于每个子项目,将其 jar 放在类路径之外的某个位置,并使输出成为packageBin该 jar。
例如(sbt 0.13 build.sbt),
lazy val main = project.dependsOn(subA)
lazy val subA = project.settings(
name := "third-party",
organization := "org.example",
version := "1.4",
packageBin in Compile := baseDirectory.value / "bin" / "third-party.jar",
// if there aren't doc/src jars use the following to
// avoid publishing empty jars locally
// otherwise, define packageDoc/packageSrc like packageBin
publishArtifact in packageDoc := false,
publishArtifact in packageSrc := false,
// tell sbt to put the jar on main's classpath
// and not the (empty) class directory
exportJars := true,
// set this to not add _<scalaBinaryVersion> to the name
crossPaths := true
)
Run Code Online (Sandbox Code Playgroud)
这种方法允许您更改 jarsubA/bin/third-party.jar并立即使用它,然后publishLocal将其发布到本地。
如果您更喜欢在本地单独发布它,以便它不是项目的一部分,请定义subA为独立项目。
| 归档时间: |
|
| 查看次数: |
1192 次 |
| 最近记录: |