SBT-fu: Publish privately
Have you’ve ever had the problem that you need to publish some Jars where your colleagues need to find them, but they are your secret web-scale sauce Jars and no one on the outside should be able to see them?
And you don’t get any permission to put the jars on a network share, and you’re not worthy of your own build server, says mr Infrastructure Manager?
And you happen to be using SBT?
There’s this wonderful service out there called Dropbox which is a small “cloud” storage solution that gives you a stash where you can put your personal files, and you have an option to have files available to the public, but they ALSO give you the possibility to _share_ folder with your trusted accomplices.
Here’s what you need to do:
1) Download and install dropbox
2) Create a new folder in your Dropbox root folder and name it something like "M2"
3) Add the following to your SBT project file
override def managedStyle = ManagedStyle.Maven
val publishTo = Resolver.file(“shared-repo”,
Path.userHome / “Dropbox” / “M2” asFile)
This tells SBTs “publish” action to place your artifacts in your "M2" folder in your dropbox root
4) Then add your awesome Dropbox M2 repo to the projects that needs to use the published artifacts
val SharedRepo = MavenRepository(“shared-repo”,
(Path.userHome / “Dropbox” / “M2”).asURL.toString)
5) Log onto www.dropbox.com and go into the “Sharing”-tab and share the M2 folder with all your awesome ninja buddies
6) Do an SBT publish, this places your freshly baked artifacts in your dropbox, and after Dropbox has synched it’s going to be propagated to your awesome friends.
7) No, seriously, you’re all done.