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

JavaAppPackaging enables Docker packaging #1337

Closed
enlait opened this issue May 4, 2020 · 5 comments
Closed

JavaAppPackaging enables Docker packaging #1337

enlait opened this issue May 4, 2020 · 5 comments

Comments

@enlait
Copy link

enlait commented May 4, 2020

Expected behaviour

According to documentation:

https://www.scala-sbt.org/sbt-native-packager/formats/docker.html#required-settings

enablePlugins(DockerPlugin)

I expect that enabling docker plugin explicitly is required for enabling docker-related tasks.

Actual behaviour

enablePlugins(JavaAppPackaging) is enough to make docker:publish

Information

  • sbt-native-packager 1.7.1

  • sbt version 1.3.4

  • empty project (no source code except build files) with single module

  • addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.1")

  • lazy val test = (project in file(".")).enablePlugins(JavaAppPackaging)

So whats the issue: I have a large multi-module project, with several java executable modules. Some of those are published as docker images; but not all of them. I also rely heavily on build aggregation, so that I would only trigger publish on the root and have all the stuff where it should be. Enabled-by-default publishing behaviour means that modules that were not properly configured for publishing could end up published... somehow, somewhere.

I was using sbt native packager + sbt docker, and now I'm rewriting my builds to use only native packager; and this behaviour caught me by surprise.

@enlait
Copy link
Author

enlait commented May 4, 2020

My bad, this is actually intended behaviour...
https://sbt-native-packager.readthedocs.io/en/latest/archetypes/java_app/index.html

I guess I'll have to manually disable docker publishing for individual modules.

@enlait enlait closed this as completed May 4, 2020
@muuki88
Copy link
Contributor

muuki88 commented May 4, 2020

Thanks for the well done issue 😊

Yes, the behaviour is intended. Users should configure as less as possible. Josh called this "batteries included"

@enlait
Copy link
Author

enlait commented May 5, 2020

Well, I still have kind of and issue: publishArtifact := false doesn't prevent native packager from building an image with publishLocal and pushing it to remote repo with publish

@muuki88
Copy link
Contributor

muuki88 commented May 5, 2020

This isn't implemented in native-packager AFAIK. To override the publishing for a specific format you need to do something like

Docker / publishLocal := { },
Docker / publish := {}

@enlait
Copy link
Author

enlait commented May 6, 2020

Thank you, that worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants