Publish Debian package for Artifactory using sbt
I am using sbt-native-packager to create and publish Debian packages for my Scala Play 2 project to the Artifactory repository.
So far I can generate the package .deb
, but I cannot post it to the artifactory url. The only published artifact is the debian file .changes
, but not the actual .deb
file.
I recently upgraded to Play 2.3.2 which uses sbt 0.13.5 and sbt-native-packager 0.7.4. This could be because publishing the .deb file to artifactory was used to work with sbt-native-packager 0.7.1.
I tried really hard to figure out the problem and figured out what with the latest version I had to add debianChangelog in Debian := Some(file("src/debian/changelog"))
to my file .sbt
, but now I am stuck.
My problem is that the file is .deb
not published when I do debian:publish
. Only the file is published .changes
:[info] published atk to http:...:8081/artifactory/atk-snapshots/atk/atk/1.0-SNAPSHOT/atk-1.0-SNAPSHOT.changes
Does anyone know what I should be doing to fix my posting problem?
I have the following setup as imports and versions in the .sbt project file:
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"
And for the packing part:
// 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)
source to share
A colleague of mine showed me the fix which is described here: http://www.scala-sbt.org/sbt-native-packager/DetailedTopics/deployment.html?highlight=publish
In short, the following statement needs to be added to build.sbt:
makeDeploymentSettings(Debian, packageBin in Debian, "deb")
source to share