I have a library compiled to a jar (not an sbt project, just the jar file) that's not available on a repository.
Is there a simple way to add a reference to the jar in the filesystem/project directly?
All new SBT versions (after 0.7. x ) by default put the downloaded JARS into the . ivy2 directory in your home directory. If you are using Linux, this is usually /home/<username>/.
Apache Ivy is a transitive package manager. It is a sub-project of the Apache Ant project, with which Ivy works to resolve project dependencies. An external XML file defines project dependencies and lists the resources necessary to build a project.
To use publishing, you need to specify the repository to publish to and the credentials to use. Once these are set up, you can run publish . The publishLocal action is used to publish your project to your Ivy local file repository, which is usually located at $HOME/. ivy2/local/ .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With