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

前端 未结 7 2036
-上瘾入骨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:41

    First of all, there is no need to specify unmanagedJars explicitly unless you have more complex configuration. Simply put your JAR files into the lib directory and they will be added to the classpath (docs).

    To package an executable JAR with all the necessary dependencies use one of the SBT plugins: sbt-onejar or sbt-assembly. package simply packages your classes into a jar and doesn't bother with including dependencies whatsoever.

    The instructions in the docs of the plugins should be easy to guide you how to use them.

提交回复
热议问题