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

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

    Try this

    libraryDependencies += "com.acme.common" % "commonclass" % "1.0" from "file:///Users/bwong/git/perf-tools/commonclass/target/scala-2.11/commonclass_2.11-1.0.jar"
    

    I "sbt package" the common classproject and then just add that library dependency in my build.sbt in the dependent projects.

    Thanks to http://flummox-engineering.blogspot.com/2014/06/sbt-use-jar-file-for-librarydependencies.html for this hack.

提交回复
热议问题