I use sbt with the native packager plugin, in order to build Debian packages for our Play 2.2 applications. We use the debian:publish
in order to upload the packages to our Artifactory server, and the publish
command to publish the regular Java jars.
I'd like to be able to use the regular publish
command to published both the jar files and the Debian packages. I think I need to somehow combine the publish task in the Debian
scope with the regular one in the Compile
scope, but I can't really find any documentation on how to do that.
I came up with the following code, which works, but seems to me to be the 'wrong' way to do it:
publish := { // Also publish deb files
val value = publish.value
(publish in Debian).value
}
Especially the second line seems wrong, since it's ignoring the value. The val
is there to quiet a warning, which is another smell.
Is there a better way to do this?
You can use triggeredBy
. In your build.sbt
add following line:
publish in Debian <<= (publish in Debian).triggeredBy(publish in Compile)
PS. I think the way you did it is also fine. If you're worried about the warning you can assign the result to some val
.