Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    @darkfrog26 I didn't quite understand it, can you elaborate on that please?
    Matt Hicks
    @ilgun I want to generate an MSI to install my application on Windows, but I want my application to auto-launch after the installer completes
    Eric K Richardson
    @darkfrog26 Ah okay, I thought you had input for my question :)
    Matt Hicks
    @ekrich yeah, I was just hoping there was some way to do directly from the native packager...guess not
    Anyone have any idea how to get sbt to output something to a github actions workflow? I've been trying this, which works in my shell fine, but doesn't seem to work in gh actions: echo "TAG_VERSION=$(sbt 'print version' | tail -n 1)" >> $GITHUB_ENV
    Matt Hicks
    I'm trying to run graalvm-native-image:packageBin on Windows 11 and I'm getting: Cannot run program "native-image" (in directory "P:\prototype\native-app-test\target\graalvm-native-image"): CreateProcess error=2, The system cannot find the file specified"
    I can type native-image locally and it is found in the path and executed though
    Matt Hicks
    it references jreLink, but no such key is found
    Matt Hicks
    nevermind, figured it out
    Arun Gopalpuri
    I have a multi-module project that I'm running in Docker. I'm referencing this doc https://www.scala-sbt.org/sbt-native-packager/recipes/custom.html?highlight=multi%20module#multi-module-builds and my main class is in "main" module. I see 2 jars in target/stage/2/app/lib main.jar and root.jar. The jar main.jar has all classes from main, however. my root is empty and just has a MANIFEST.MF (I guess it should contain all classes mentioned in aggregate?). Commands I use "sbt docker:stage" or "sbt docker:publishLocal" and. both generate same jars in target
    Arun Gopalpuri
    I had to add publishArtifact in (Compile, packageDoc) := false and it started adding jars to target/stage/2/app/lib in my case
    Matt Hicks
    in the JDKPackager, is there any way to pass additional args to the jdkpackager command? Specifically I want to set the -Bruntime=... value to specify the JRE to use
    Abhijit Singh
    Hello All,
    I am facing an issue while using native packager with an base image. In base image, there are few utils installed by another user. When creating the docker image of the project the utils are not writable even after setting the WriteExecute permission. Is there a way to run a chown with root user ?
    Eric Peters
    I think I'm seeing Docker:stage compile Test sources, is there an easy way to disable that?
    Peter Zhong

    Hi all,

    Does anyone know if there's a way to add a task before docker:publish or publishLocal is triggered. My company is trying to add a preprocessing step to generate some script files to be included . Right now there's a task that generates them before compilation, but it seems at that point that's too late what's being copied has already been copied.

    Bartlomiej Tartanus
    Hello! Looks like versions 1.9.x are not uploaded to any repository, so I can't use them. Latest uploaded version is 1.8.1:
    Bartlomiej Tartanus
    Ok, looks like package name was changed to com.git.sbt :) problem solved
    Hanns Holger Rutz

    It doesn't work for me. Are you trying addSbtPlugin("com.git.sbt" % "sbt-native-packager" % "1.9.6"). I just see

    [error]   not found: https://repo1.maven.org/maven2/com/git/sbt/sbt-native-packager_2.12_1.0/1.9.6/sbt-native-packager-1.9.6.pom
    [error]   not found: /home/hhrutz/.ivy2/local/com.git.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.9.6/ivys/ivy.xml
    [error]   not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.git.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.9.6/ivys/ivy.xml
    [error]   not found: https://repo.typesafe.com/typesafe/ivy-releases/com.git.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.9.6/ivys/ivy.xml


    I'm chasing this problem - looks familiar to anyone?
    Oh, so 1.9.6 is not yet on maven? "com.github.sbt" % "sbt-native-packager" % "1.9.4" seems to work
    Hanns Holger Rutz

    Errr, annoying

    [error] java.lang.RuntimeException: found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
    [error]     * org.scala-lang.modules:scala-parser-combinators_2.12:2.0.0 (early-semver) is selected over {1.0.5, 1.0.4, 1.1.2, 1.1.2}
    [error]         +- com.github.sbt:sbt-native-packager:1.9.4 (sbtVersion=1.0, scalaVersion=2.12) (depends on 2.0.0)
    [error]         +- org.wvlet.airframe:airframe-launcher_2.12:20.10.3  (depends on 1.1.2)
    [error]         +- org.wvlet.airframe:airframe-control_2.12:20.10.3   (depends on 1.1.2)
    [error]         +- com.typesafe:ssl-config-core_2.12:0.2.2            (depends on 1.0.4)
    [error]         +- com.github.sbt:pgp-library_2.12:2.1.2              (depends on 1.0.5)

    Any ideas where the last comes from, and which native packager version still uses 1.x of parser combinators?

    With 1.8.1, I am seeing this problem; I don't know why it appears now, i don't I had changed the plugin version before. Any clues?

    [info] Running: jdeps --multi-release 11 -R ...
    [error] Exception in thread "main" java.lang.module.FindException: Module java.activation not found, required by java.xml.bind
    [error]     at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
    [error]     at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
    [error]     at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
    [error]     at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
    [error]     at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
    [error]     at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:564)
    [error]     at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:603)
    [error]     at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:557)
    [error]     at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:533)
    [error]     at jdk.jdeps/com.sun.tools.jdeps.Main.run(Main.java:64)
    [error]     at jdk.jdeps/com.sun.tools.jdeps.Main$JDepsToolProvider.run(Main.java:73)
    [error]     at java.base/java.util.spi.ToolProvider.run(ToolProvider.java:137)
    [error]     at ru.eldis.toollauncher.ToolLauncher.runTool(ToolLauncher.java:68)
    [error]     at ru.eldis.toollauncher.ToolLauncher.lambda$main$1(ToolLauncher.java:33)
    [error]     at ru.eldis.toollauncher.ToolLauncher.main(ToolLauncher.java:48)

    Urgently need help fixing this.

    Hanns Holger Rutz
    Seems to have been a dependency problem of Pi4J which depends on javax.bind.xml which depends on javax.activation-api
    Gabriel Volpe

    Hi folks 👋, quick question: I have a multi-module sbt project. Module B depends on module A, in both compile and test scopes, i.e.

    .dependsOn(moduleA % "compile->compile;compile->test")

    Module A defines a few scalacheck generators, which I'm using in the main method of Module B.

    The issue is that when I run the generated Docker container of Module B, it fails at runtime with java.lang.NoClassDefFoundError: moduleA/generators$ because the moduleA_test jar is not in scope. Any ideas on how I can make this work?

    Keir Lawson
    ^ I came here to ask this exact same question...
    Keir Lawson
    did you find a solution @gvolpe:matrix.org ?
    Keir Lawson
    I believe the issue is captured here: sbt/sbt-native-packager#1221
    Gabriel Volpe
    No, I did not, unfortunately. That issue seems to be related but I'm not sure if it's the same. In my case, moduleA is NOT marked as noPublish, so it is effectively bundled and the jar is published but not the module-tests.jar, which is the one moduleB depends on, and it all runs from sbt but fails to be packaged correctly.
    There should be no problem using native packager to publish to Github Container Registry, right?
    Denis Mikhaylov
    Hey folks. I have two modules. Module A depends on module B. Module B contains foo.Main. But DockerPlugin is enabled for A, and Compile / mainClass is set to "foo.Main". When I run Docker / publishLocal on A there's no foo.Main on class path of the resulting container. I tried to run Universal / packageBin and foo.Main is missing from generated zip. Any idea why?
    1 reply

    Hi folks, seeing issue on packaging. conf/application.ini is duplicated in final package.
    Packaging on mac

    scalaVersion := "2.12.10"

    Shipping to linux box and unzip is causing zipbomb

    unzip -o reports-rs.zip
    Archive:  reports-rs.zip
      inflating: conf/application.ini
    error: invalid zip file with overlapped components (possible zip bomb)
    Harry Tran
    Hello... is there a way to add RUN microdnf update -y && microdnf clean all after FROM baseImage as mainstage?
    Hi, maybe someone has encountered this behavior before. I've a multi module project and tried to call "sbt my-subproject / docker:stage" but nothing happens, no directory with a dockerfile or prepared environment is created. And because the sbt-native-packager documentation does exclude sub projects explicitly, it should work, right? Or did I miss something substantial?
    Naftoli Gugenheim
    @cheapsolutionarchitect if you do that from your shell you need quotes so SBT gets that as one argument despite having spaces
    Other than that, the full output would be helpful
    It works, I just forgot the quotes :)
    Tom Lous
    Hi I have 2 questions:
    1. Can I somehow specify in the GraalVMNativeImage in my build.sbt to build the image for linux/amd64 instead of the linux ARM aarch64, which matches my Mac M1 Pro arch prob

    2.Why can't it find my mainclass when building in the Azure pipeline, but it can find it doing local builds?

    Error: Main entry point class 'ManualBackfill' not found.

    I've added my config & logs in these gists https://gist.github.com/TomLous/87a4e8050486486d9aa8dce340c6fdfd

    Tom Lous

    A main difference I see in the logs is that my mac route adds scala to the classpath

    [info] -imagecp \
    [info] /opt/graalvm/stage/lib/scala-reflect.jar:/opt/graalvm/stage/lib/scala-library.jar:/opt/graalvm/stage/lib/nl.schiphol.dna.cdf.dnwg-gateway-0.1.0.jar:...


    [info] -imagecp \
    [info] /opt/graalvm/stage/lib/nl.schiphol.dna.cdf.dnwg-gateway-0.1.0.jar:...
    Tom Lous
    I tried it on github actions, that works. So it's definitively something different in the azure env, but they are pulling the exact same image. Can't figure it out yet. Updated the gist
    I'm facing some strange issues when running sbt-native-packager to generate a Docker image for a multi module scala sbt project.
    The problem that I'm facing is that the generated Dockerfile seems not enough. Either I'm missing some settings that I need to add, but I'm not sure which ones?
    Raphael Mäder
    Hi all. I'm trying to publish a Docker image with a project managed by sbt-web-scalajs. That plugin has a setting scalaJSStage which can be set to FullOptStage in order to generate a minimized and optimized JS file. However, I failed to figure out how I can set this setting only when publishing the Docker image, and not during any other compilation (i.e. when running the project locally). Does someone know how to do this? Many thanks.
    1 reply
    Oliver Schrenk

    I'm trying to publish an image with two different tags.

    I'm running into sbt/sbt-native-packager#1368 .

    Is there another way to publish mutliple tags?

    As a secondary question: I wanted to investigate the issue but couldn''t find out how to output the debug logs? What flag/setting can I use?

    Milan van der Meer
    Question about using sbt-native-package with sbt-javaagent. Am I correct that if you add a javaagent with java -javaagent ... -cp ... the javaagent library itself will not be added on the classpath directly?

    I have a playframework application what I run as debian file generated by sbt-native-packager. In the production.conf file I need to access HOST_IP & secret as environment variable.

    But systemd can't access export HOST_IP=$(hostname -I | awk '{print $1}') and secret env.

    Is there any way that I can pass environment variable to my debian app production.conf which is run by systemctl ?


    Question about SBT native packager and Github Actions.

    I'm trying to configure CI/CD using Github Actions. I have a multi-module SBT project. When doing sbt docker:publish, it says that "repository for publishing is not specified". This is with dockerRepository setting set in build.sbt for root project. So I tried to do sbt docker:publishLocal into docker tag->docker push, however it seems to me that Github Actions treats the sbt docker:publishLocal step as finished as soon as the first submodule is built, therefore fails to find the local tag of the root project with the error Error response from daemon: No such image: tag:1.0

    Did anyone have a similar problem, and how did you fix that?

    Ondřej Španěl
    I am unable to use the plugin in my project. I have created an issue, see sbt/sbt-native-packager#1526, but I feel like I must be missing something?
    The error is: "Error downloading com.typesafe.sbt:sbt-native-packager;sbtVersion=1.0;scalaVersion=2.12:1.9.4"
    Hi everyone! For some reason, sbt-native-packager puts my app's jar into the 4lib directory on Docker/stage. At the same time, the bash script inside the bin dir assumes the jar is in the lib folder just as the rest of the classpath of the application. What is the possible solution to this?