sbt: How can I add a local filesystem jar to my project?

不想你离开。 提交于 2019-12-02 15:43:41

You can put the jar in your project's lib folder (create it if it doesn't exist), it will then appear on your project's unmanaged-classpath.

To publish a jar file locally, if you have an sbt project that produces the jar, it should be as simple as invoking "publish-local" to publish the jar to your local ivy repository so that you can use that jar in another one of your projects (on the same computer).

Your SBT project should be structured like this:

README.md
build.sbt
project/
src/
target/

Create a lib/ directory to add a JAR file (e.g. spark-daria_2.11-0.2.0.jar) to the project:

README.md
build.sbt
lib/
  spark-daria_2.11-0.2.0.jar
project/
src/
target/

The location of the lib/ directory should line-up with the output of the sbt "show unmanagedBase" command.

Refresh the project in your IDE and import the code just like you would import an external dependency.

import com.github.mrpowers.spark.daria.sql.DataFrameValidator
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!