SBT Plugin for Resolving and Publishing via Amazon S3
Posted on 8 May 2014, 9:00 AM PDT by Tim Underwood under Open Source
I recently wrote an SBT plugin that allows you to resolve and publish using Amazon's S3 service. This is useful if you want to use S3 as a private Maven (or Ivy) repository. I've released the plugin as open source under the Apache 2.0 License.
The source code is available on GitHub: https://github.com/frugalmechanic/fm-sbt-s3-resolver
Usage
The plugin is available on Maven Central so all you have to do is add it as a plugin to your project/plugins.sbt file:
addSbtPlugin("com.frugalmechanic" % "fm-sbt-s3-resolver" % "0.9.0")
You also need to make your S3 credentials available to the plugins via one of the methods specified in the README.md file. The easiest method is to just create a ~/.sbt/.s3credentials file of the following format:
accessKey = XXXXXXXXXX
secretKey = XXXXXXXXXX
Resolving
Just add your s3:// URL to the SBT Resolvers:
resolvers += "FrugalMechanic Snapshots" at "s3://maven.frugalmechanic.com/snapshots"
Note: If your bucket is public then you don't need the plugin and can just use the normal https:// URL.
Publishing
Just use the s3:// URL:
publishTo := Some("FrugalMechanic Snapshots" at "s3://maven.frugalmechanic.com/snapshots")
URL Formats
Just take whatever the https:// (or http://) URL for your S3 bucket would be and replace it with s3://. In the examples above I'm using a maven.frugalmehanic.com as a Static Website Using a Custom Domain where maven.frugalmechanic.com is the bucket name. The long form would also work:
s3://s3-us-west-2.amazonaws.com/maven.frugalmechanic.com/snapshots/