How to include an external jar file into the jar with package?

前端 未结 7 2371
-上瘾入骨i
-上瘾入骨i 2020-12-08 02:26

My project has dependency on an external jar. I have created a directory lib and have copied the jar file into it. This is my build.sbt:

         


        
7条回答
  •  悲&欢浪女
    2020-12-08 02:58

    tl;dr Move project/build.sbt one level up where lib directory is and use sbt-assembly plugin (as described in the other answer by Aleksey).

    If the project directory layout is as you use for your project, it's incorrect since build.sbt does not belong to the same build where lib does.

    Since sbt is recursive this project/build.sbt describes the project's build that governs the main one. Quoting the docs:

    The project directory is another project inside your project which knows how to build your project. The project inside project can (in theory) do anything any other project can do. Your build definition is an sbt project.

    And the turtles go all the way down. If you like, you can tweak the build definition of the build definition project, by creating a project/project/ directory.

提交回复
热议问题