Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a custom scala library using sbt?

Tags:

scala

sbt

Like it says on the tin, how would I go by creating a library using sbt?

I have a set of utilities and convenience functions that I want to be easily distributed between my projects. The easiest way to do this of course, is by having them compile to a library, that I can then include in the build path of any given project that'll use it.

Libraries are often much easier to include in multiple projects than having multiple copies of the same classes. So how would I do this?

like image 949
Electric Coffee Avatar asked Jul 19 '14 16:07

Electric Coffee


1 Answers

Just create a project with the library code, and use the publishLocal command to put it in your local Ivy repo. Then you can include it in other projects.

This next bit may be overkill for your case, but I have this blog post outlining how to do all of this for an open source project. Perhaps you'll use it as inspiration to make it available for us all to enjoy. :)

like image 190
joescii Avatar answered Sep 28 '22 09:09

joescii