Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
164 lines (119 sloc) 4.43 KB


Deploy and consume artifacts in private S3 repositories. Designed to be used from Leiningen, but should be usable in other contexts by deploying to repositories at "s3p://" URLs.


Leiningen 2.x

Add the plugin and repositories listing to project.clj:

:plugins [[s3-wagon-private "1.1.2"]]

You can store credentials either in an encrypted file or as environment variables. For the encrypted file, add this to project.clj:

:repositories {"private" {:url "s3p://mybucket/releases/" :creds :gpg}}

And in ~/.lein/credentials.clj.gpg:

{"s3p://mybucket/releases" {:username "AKIA2489AE28488"
                            :passphrase "98b0b104ca1211e19a6c"}}

The map key here can be either a string for an exact match or a regex checked against the repository URL if you have the same credentials for multiple repositories.

To use the environment for credentials, include :creds :env instead of :creds :gpg and export LEIN_USERNAME and LEIN_PASSPHRASE environment variables.

See lein help deploying for details on storing credentials.

Currently in Leiningen 2 you have to manually activate the plugin with the following form at the bottom of project.clj:

 "s3p" #(eval '(

Future versions should remove the need for this declaration.

Leiningen 1.x

As above, add the plugin and repositories listing to project.clj:

:plugins [[s3-wagon-private "1.1.2"]]
:repositories {"private" {:url "s3p://mybucket/releases/"}}

On 1.x you keep S3 credentials in ~/.lein/init.clj:

(def leiningen-auth {"s3p://mybucket/releases/"
                     {:username "ACCESS_KEY"
                      :passphrase "SECRET_KEY"}
                     {:username "ACCESS_KEY"
                      :passphrase "SECRET_KEY"}})

Note that deploying an artifact that doesn't already exist will cause an org.jets3t.service.S3ServiceException stack trace to be emitted; this is a bug in one of the underlying libraries but is harmless.

If you are running Leiningen in an environment where you don't control the user such as Heroku or Jenkins, you can include credentials in the :repositories entry. However, you should avoid committing them to your project, so you should take them from the environment using System/getenv:

(defproject my-project "1.0.0"
  :plugins [[s3-wagon-private "1.1.2"]]
  :repositories {"releases" {:url "s3p://mybucket/releases/"
                             :username (System/getenv "AWS_ACCESS_KEY")
                             :passphrase (System/getenv "AWS_SECRET_KEY")}})




    <!-- to publish to a private bucket -->

                    <name>Some Name</name>
                    <name>Some Snapshot Name</name>

     <!-- to consume artifacts from a private bucket -->

            <name>Some Name</name>


            <!-- you can actually put the key and secret in here, I like to get them from the env -->


Copyright © 2011-2012 Phil Hagelberg and Scott Clasen

Based on aws-maven from the Spring project.

Distributed under the Apache Public License version 2.0.

Jump to Line
Something went wrong with that request. Please try again.