使用sbt将Debian包发布到Artifactory

时间:2014-08-10 13:24:42

标签: sbt-native-packager

我正在使用sbt-native-packager为我的Scala Play 2项目创建和发布Debian软件包到Artifactory存储库。

到目前为止,我能够生成.deb包,但我无法将其发布到神器URL。发布的唯一工件是debian .changes文件,但不是实际的.deb文件。

我最近升级到Play 2.3.2,它使用sbt 0.13.5和sbt-native-packager 0.7.4。这可能是相关的,因为将.deb文件发布到工件确实曾用于sbt-native-packager 0.7.1。

我努力了解这个问题并且确实发现使用最新版本我必须将debianChangelog in Debian := Some(file("src/debian/changelog"))添加到我的.sbt文件中,但我现在被卡住了。

我的问题只是在.deb时发布了debian:publish个文件。只发布.changes个文件:
[info] published atk to http:...:8081/artifactory/atk-snapshots/atk/atk/1.0-SNAPSHOT/atk-1.0-SNAPSHOT.changes

有人知道我该做什么,以解决我的发布问题吗?

我在项目的.sbt文件中将以下设置作为导入和版本:

import com.typesafe.sbt.SbtNativePackager._
import com.typesafe.sbt.SbtNativePackager.NativePackagerKeys._
import com.typesafe.sbt.packager.archetypes.ServerLoader.SystemV
import NativePackagerKeys._

name := """atk"""

scalacOptions += "-target:jvm-1.7"

javacOptions ++= Seq("-source", "1.7", "-target", "1.7")

version := "1.1-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.1"

对于包装部分:

// Packaging info

debianChangelog in Debian := Some(file("src/debian/changelog"))

serverLoading in Debian := SystemV

packageDescription in Debian := "Parlis Elvis Adapter"

packageSummary in Debian := "Parlis Elvis Adapter"

maintainer in Debian := "Daan Hoogenboezem"

daemonUser in Linux := "ape"

daemonGroup in Linux := "ape"

sourceDirectory in Debian <<= (sourceDirectory) apply (_ / "debian")

mappings in Universal <+= (packageBin in Compile, sourceDirectory ) map { (_, src) =>
    // we are using the reference.conf as default application.conf
    // the user can override settings here
    val conf = src / "linux" / "atk" / "startup.conf"
    conf -> "etc/atk/startup.conf"
}

linuxPackageMappings in Debian <+= (name in Universal, sourceDirectory in Debian) map { (name, dir) =>
  (packageMapping(
    (dir / "etc/changelog") -> "/usr/share/doc/atk/changelog.gz"
  ) withUser "root" withGroup "root" withPerms "0644" gzipped) asDocs()
}

defaultLinuxLogsLocation in Linux := "/var/log/atk"

deploymentSettings

// Publishing
publishTo := {
  val artifactory = "http://...:8081/artifactory/"
  if (version.value.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at artifactory + "atk-snapshots")
  else
    Some("releases" at artifactory + "atk-releases")
}

publish in Debian <<= (publish in Debian).triggeredBy(publish in Compile)

1 个答案:

答案 0 :(得分:2)

我的一位同事向我展示了修复程序,此处记录在案:http://www.scala-sbt.org/sbt-native-packager/DetailedTopics/deployment.html?highlight=publish

简而言之,需要将以下语句添加到build.sbt:

makeDeploymentSettings(Debian, packageBin in Debian, "deb")