lein-maven-s3-wagon

A leiningen plugin for publishing to a private S3 maven repository.


License
MPL-2.0

Documentation

lein-maven-s3-wagon

What is this?

This is a leiningen plugin that wraps my fork of maven-s3-wagon.

What is an S3 wagon?

It is a maven plugin that allows you to publish and retrieve maven artifacts directly from S3.

Why did you fork maven-s3-wagon?

I forked it because I wanted an S3 wagon:

  1. That supports AWS multi-factor authentication (which maven-s3-wagon does), and
  2. That supports private S3 repos (which maven-s3-wagon does).

Sooo, why did you fork it again?

As far as I can tell, maven-s3-wagon doesn’t actually support using multi-factor authentication except if you’re running maven on an EC2 node. In addition to pulling in your access key and secret key from the environment, my fork also pulls in your session token from the environment.

Also, the way you publish to a private S3 repo with maven-s3-wagon is by configuring it to use a private ACL in your ~/.m2/settings.xml. As far as I can tell, there is no way to do this with leiningen (patches welcome!). My fork uses a private ACL as its default ACL.

OK, so how do I use it?

Add it to your project.clj as a plugin and define your repository:

(defproject my-project "0.1.0-SNAPSHOT"
  ...
  :deploy-repositories [["my-private-repo" {:url "s3://my-maven-repo/releases/"
                                            :username "AWS ACCESS KEY ID"
                                            :password "AWS SECRET ACCESS KEY"}]]
  ...
  :plugins [[lein-maven-s3-wagon "0.2.4"]]
  ...)

Then you can publish your artifact to S3 using:

lein deploy my-private-repo

Do I have to have my AWS creds in the project.clj?

Absolutely not! Like any other repo, you can specify your credentials in your project.clj or specify them in ~/.lein/credentials.clj.gpg. You can also use keywords with the ‘env’ namespace (like :env/aws_access_key_id to have the credentials pulled from the environment).

Regardless of where the access key and secret key are pulled from, your session token for multi-factor authentication will always be pulled from the AWS_SECURITY_TOKEN environment variable. This environment variable name is compatible with the AWS command line interface (http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)

License

Copyright © 2014 Paul Stadig. All rights reserved.

This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/.

This Source Code Form is "Incompatible With Secondary Licenses", as defined
by the Mozilla Public License, v. 2.0.