Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish universal tgz artifact only #349

Closed
yatskevich opened this issue Sep 12, 2014 · 7 comments
Closed

Publish universal tgz artifact only #349

yatskevich opened this issue Sep 12, 2014 · 7 comments
Labels
universal Zip, tar.gz, tgz and bash issues

Comments

@yatskevich
Copy link

Hi guys,

I'm using version 0.6.4 of the plugin (provided by Play Framework 2.2.x) and tried to disable publishing of universal zip artifact using the following setting:

publishArtifact in(Universal, packageBin) := false

but zip is still being published along with tgz when I run universal:publish.

Am I missing something?

Thanks in advance!

@muuki88 muuki88 added the universal Zip, tar.gz, tgz and bash issues label Sep 12, 2014
@muuki88
Copy link
Contributor

muuki88 commented Sep 12, 2014

Hi,

Can you post the related settings of your build.sbt? On possible options is
you included deploymentSettings which adds everything to your deployment settings. See this stackoverflow question for some hints.

@yatskevich
Copy link
Author

@muuki88 That's true, I've included deploymentSettings.

import com.typesafe.sbt.SbtNativePackager._

val myReleaseSettings = Seq(
  sources in(Compile, doc) := Seq.empty,
  publishArtifact in(Compile, packageDoc) := false,
  publishArtifact in(Compile, packageSrc) := false
) ++ deploymentSettings

Also I've tried to add addPackage(Universal, packageZipTarball in Universal, "tgz") settings instead of complete deploymentSettings, but in this case only jar file is being published, not tgz artifact.

@gvolpe
Copy link

gvolpe commented Nov 10, 2014

I have the same question.

I'm using Play framework 2.3.5 and I want to disable the publish of the zip file. I want only the tgz file.

Thank you!

@drxcc
Copy link

drxcc commented Nov 11, 2014

The deploymentSettings include a the zip, tgz and more however I wanted to refine the settings to only include the zip. For tgz instead of zip you could use packageZipTarball instead of packageBin and change the zip extensions to tgz. Here is the solution I finally used:

//--use sbt-native-packager default java application 
packageArchetype.java_application

//--a dummy task to hold the result of the universal:packageBin to stop the circular dependency issue
val packageZip = taskKey[File]("package-zip")

//--hard coded result of "universal:packageBin"
packageZip := (baseDirectory in Compile).value / "target" / "universal" / (name.value + "-" + version.value + ".zip")

//--label the zip artifact as a zip instead of the default jar
artifact in (Universal, packageZip) ~= { (art:Artifact) => art.copy(`type` = "zip", extension = "zip") }

//--add the artifact so it is included in the publishing tasks
addArtifact(artifact in (Universal, packageZip), packageZip in Universal)

//--make sure the zip gets made before the publishing commands for the added artifacts
publish <<= (publish) dependsOn (packageBin in Universal)

publishM2 <<= (publishM2) dependsOn (packageBin in Universal)

publishLocal <<= (publishLocal) dependsOn (packageBin in Universal)

The key pieces of this solution came from a comment from yanns and dgrandes

@muuki88
Copy link
Contributor

muuki88 commented Nov 13, 2014

I will close this issue as @drxcc provided a nice workaround for 0.6.4 with the newer versions of sbt-native-packager you should either

import com.typesafe.sbt.packager.SettingsHelper._

makeDeploymentSettings(Universal, packageBin in Universal, "zip")

or

// however this will enabled everything 
enablePlugins(UniversalDeployPlugin)

@muuki88 muuki88 closed this as completed Nov 13, 2014
@drxcc
Copy link

drxcc commented Nov 13, 2014

I tried makeDeploymentSettings(..., "zip") without including everything from deploymentSettings and it works. However it seems to only be included in:

universal:publish & universal:publishLocal but not universal:publishM2

The source code for SettingsHelper.makeDeploymentSettings seems to leave out publishM2

@muuki88
Copy link
Contributor

muuki88 commented Nov 13, 2014

Yeah. I think the API is older than the publishM2 task as this one was added in 0.13.0. So we might add this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

No branches or pull requests

4 participants