Krijn
Krijn

Reputation: 81

Publish Debian package to Artifactory using sbt

I am using sbt-native-packager to create and publish Debian packages for my Scala Play 2 project to an Artifactory repository.

So far, I am able to generate the .deb package, but I fail to get it published to the artifactory URL. The only artifact that gets published is a debian .changes file, 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 might be related, as publishing of a .deb file to the artifactory did used to work with sbt-native-packager 0.7.1.

I have tried hard to understand the problem and did figure out that with the latest version I had to add debianChangelog in Debian := Some(file("src/debian/changelog")) to my .sbt file, but I am stuck now.

My problem is simply that no .deb file is published when I do debian:publish. Only the .changes file gets published:
[info] published atk to http:...:8081/artifactory/atk-snapshots/atk/atk/1.0-SNAPSHOT/atk-1.0-SNAPSHOT.changes

Does someone know what I should do, to fix my publishing problem?

I've the following setup as imports and versions in the project's .sbt 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 packaging 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)

Upvotes: 5

Views: 1061

Answers (1)

Krijn
Krijn

Reputation: 81

A colleague of mine showed me the fix, which is documented here: http://www.scala-sbt.org/sbt-native-packager/DetailedTopics/deployment.html?highlight=publish

In short, the following statement needs to be added to the build.sbt:

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

Upvotes: 3

Related Questions