Include Dependencies in JAR using SBT package












6














Apparently project dependencies are not being packaged into the jar generated by:



sbt package


How can dependencies be included?










share|improve this question






















  • github.com/sbt/sbt-assembly
    – dmitry
    Sep 30 '15 at 8:38






  • 1




    scala-sbt.org/sbt-native-packager
    – Aaron
    Sep 30 '15 at 8:50










  • @dmitry Has problems with Spark. Stackoverflow is loaded with similar interop problems.
    – BAR
    Sep 30 '15 at 8:52










  • @Aaron +1 for learning something new. docs and activity look good. attempting this.
    – BAR
    Sep 30 '15 at 9:02












  • stackoverflow.com/questions/38335207/…
    – Barbaros Alp
    Jul 13 '16 at 12:22
















6














Apparently project dependencies are not being packaged into the jar generated by:



sbt package


How can dependencies be included?










share|improve this question






















  • github.com/sbt/sbt-assembly
    – dmitry
    Sep 30 '15 at 8:38






  • 1




    scala-sbt.org/sbt-native-packager
    – Aaron
    Sep 30 '15 at 8:50










  • @dmitry Has problems with Spark. Stackoverflow is loaded with similar interop problems.
    – BAR
    Sep 30 '15 at 8:52










  • @Aaron +1 for learning something new. docs and activity look good. attempting this.
    – BAR
    Sep 30 '15 at 9:02












  • stackoverflow.com/questions/38335207/…
    – Barbaros Alp
    Jul 13 '16 at 12:22














6












6








6


4





Apparently project dependencies are not being packaged into the jar generated by:



sbt package


How can dependencies be included?










share|improve this question













Apparently project dependencies are not being packaged into the jar generated by:



sbt package


How can dependencies be included?







scala sbt






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 30 '15 at 6:33









BAR

6,3901164122




6,3901164122












  • github.com/sbt/sbt-assembly
    – dmitry
    Sep 30 '15 at 8:38






  • 1




    scala-sbt.org/sbt-native-packager
    – Aaron
    Sep 30 '15 at 8:50










  • @dmitry Has problems with Spark. Stackoverflow is loaded with similar interop problems.
    – BAR
    Sep 30 '15 at 8:52










  • @Aaron +1 for learning something new. docs and activity look good. attempting this.
    – BAR
    Sep 30 '15 at 9:02












  • stackoverflow.com/questions/38335207/…
    – Barbaros Alp
    Jul 13 '16 at 12:22


















  • github.com/sbt/sbt-assembly
    – dmitry
    Sep 30 '15 at 8:38






  • 1




    scala-sbt.org/sbt-native-packager
    – Aaron
    Sep 30 '15 at 8:50










  • @dmitry Has problems with Spark. Stackoverflow is loaded with similar interop problems.
    – BAR
    Sep 30 '15 at 8:52










  • @Aaron +1 for learning something new. docs and activity look good. attempting this.
    – BAR
    Sep 30 '15 at 9:02












  • stackoverflow.com/questions/38335207/…
    – Barbaros Alp
    Jul 13 '16 at 12:22
















github.com/sbt/sbt-assembly
– dmitry
Sep 30 '15 at 8:38




github.com/sbt/sbt-assembly
– dmitry
Sep 30 '15 at 8:38




1




1




scala-sbt.org/sbt-native-packager
– Aaron
Sep 30 '15 at 8:50




scala-sbt.org/sbt-native-packager
– Aaron
Sep 30 '15 at 8:50












@dmitry Has problems with Spark. Stackoverflow is loaded with similar interop problems.
– BAR
Sep 30 '15 at 8:52




@dmitry Has problems with Spark. Stackoverflow is loaded with similar interop problems.
– BAR
Sep 30 '15 at 8:52












@Aaron +1 for learning something new. docs and activity look good. attempting this.
– BAR
Sep 30 '15 at 9:02






@Aaron +1 for learning something new. docs and activity look good. attempting this.
– BAR
Sep 30 '15 at 9:02














stackoverflow.com/questions/38335207/…
– Barbaros Alp
Jul 13 '16 at 12:22




stackoverflow.com/questions/38335207/…
– Barbaros Alp
Jul 13 '16 at 12:22












2 Answers
2






active

oldest

votes


















4














There's a project called onejar that will package a project and all its dependencies into a single jar file. There is an SBT plugin as well:



https://github.com/sbt/sbt-onejar



However if you're just looking to create a standard package (deb, rpm, etc.) there is sbt-native-packager:



https://github.com/sbt/sbt-native-packager



It can place all your dependencies into a Linux package and add the appropriate wrappers to load all your dependencies and start your program or service.






share|improve this answer





























    9














    Well, I use sbt-assembly plugin to create jar with dependencies,



    (1) add sbt-assembly to projects/assembly.sbt



    echo 'addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")' > project/assembly.sbt


    (2) run sbt clean assembly to build the jar.
    It will create ${name}-assembly-${version}.jar in target/scala-${scalaVersion}



    (3) Only in case you get infamous de-duplicate error, use assemblyMergeStrategy as described in here






    share|improve this answer



















    • 1




      Note that sbt-assembly is not available for scala 2.11 (and never will be)
      – HansHarhoff
      Feb 17 at 13:43











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32859316%2finclude-dependencies-in-jar-using-sbt-package%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    There's a project called onejar that will package a project and all its dependencies into a single jar file. There is an SBT plugin as well:



    https://github.com/sbt/sbt-onejar



    However if you're just looking to create a standard package (deb, rpm, etc.) there is sbt-native-packager:



    https://github.com/sbt/sbt-native-packager



    It can place all your dependencies into a Linux package and add the appropriate wrappers to load all your dependencies and start your program or service.






    share|improve this answer


























      4














      There's a project called onejar that will package a project and all its dependencies into a single jar file. There is an SBT plugin as well:



      https://github.com/sbt/sbt-onejar



      However if you're just looking to create a standard package (deb, rpm, etc.) there is sbt-native-packager:



      https://github.com/sbt/sbt-native-packager



      It can place all your dependencies into a Linux package and add the appropriate wrappers to load all your dependencies and start your program or service.






      share|improve this answer
























        4












        4








        4






        There's a project called onejar that will package a project and all its dependencies into a single jar file. There is an SBT plugin as well:



        https://github.com/sbt/sbt-onejar



        However if you're just looking to create a standard package (deb, rpm, etc.) there is sbt-native-packager:



        https://github.com/sbt/sbt-native-packager



        It can place all your dependencies into a Linux package and add the appropriate wrappers to load all your dependencies and start your program or service.






        share|improve this answer












        There's a project called onejar that will package a project and all its dependencies into a single jar file. There is an SBT plugin as well:



        https://github.com/sbt/sbt-onejar



        However if you're just looking to create a standard package (deb, rpm, etc.) there is sbt-native-packager:



        https://github.com/sbt/sbt-native-packager



        It can place all your dependencies into a Linux package and add the appropriate wrappers to load all your dependencies and start your program or service.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 1 '16 at 8:21









        djsumdog

        1,1681232




        1,1681232

























            9














            Well, I use sbt-assembly plugin to create jar with dependencies,



            (1) add sbt-assembly to projects/assembly.sbt



            echo 'addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")' > project/assembly.sbt


            (2) run sbt clean assembly to build the jar.
            It will create ${name}-assembly-${version}.jar in target/scala-${scalaVersion}



            (3) Only in case you get infamous de-duplicate error, use assemblyMergeStrategy as described in here






            share|improve this answer



















            • 1




              Note that sbt-assembly is not available for scala 2.11 (and never will be)
              – HansHarhoff
              Feb 17 at 13:43
















            9














            Well, I use sbt-assembly plugin to create jar with dependencies,



            (1) add sbt-assembly to projects/assembly.sbt



            echo 'addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")' > project/assembly.sbt


            (2) run sbt clean assembly to build the jar.
            It will create ${name}-assembly-${version}.jar in target/scala-${scalaVersion}



            (3) Only in case you get infamous de-duplicate error, use assemblyMergeStrategy as described in here






            share|improve this answer



















            • 1




              Note that sbt-assembly is not available for scala 2.11 (and never will be)
              – HansHarhoff
              Feb 17 at 13:43














            9












            9








            9






            Well, I use sbt-assembly plugin to create jar with dependencies,



            (1) add sbt-assembly to projects/assembly.sbt



            echo 'addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")' > project/assembly.sbt


            (2) run sbt clean assembly to build the jar.
            It will create ${name}-assembly-${version}.jar in target/scala-${scalaVersion}



            (3) Only in case you get infamous de-duplicate error, use assemblyMergeStrategy as described in here






            share|improve this answer














            Well, I use sbt-assembly plugin to create jar with dependencies,



            (1) add sbt-assembly to projects/assembly.sbt



            echo 'addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")' > project/assembly.sbt


            (2) run sbt clean assembly to build the jar.
            It will create ${name}-assembly-${version}.jar in target/scala-${scalaVersion}



            (3) Only in case you get infamous de-duplicate error, use assemblyMergeStrategy as described in here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 21 at 2:45

























            answered Dec 1 '16 at 7:55









            prayagupd

            19.5k889136




            19.5k889136








            • 1




              Note that sbt-assembly is not available for scala 2.11 (and never will be)
              – HansHarhoff
              Feb 17 at 13:43














            • 1




              Note that sbt-assembly is not available for scala 2.11 (and never will be)
              – HansHarhoff
              Feb 17 at 13:43








            1




            1




            Note that sbt-assembly is not available for scala 2.11 (and never will be)
            – HansHarhoff
            Feb 17 at 13:43




            Note that sbt-assembly is not available for scala 2.11 (and never will be)
            – HansHarhoff
            Feb 17 at 13:43


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32859316%2finclude-dependencies-in-jar-using-sbt-package%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'