Skip to content

Commit

Permalink
Explain how to manually register the wagon for lein2. Fixes #4.
Browse files Browse the repository at this point in the history
Hopefully we'll have a better solution for this soon.
  • Loading branch information
technomancy committed Jul 9, 2012
1 parent 0cbb119 commit 0701fb5
Showing 1 changed file with 54 additions and 21 deletions.
75 changes: 54 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,59 @@ but should be usable in other contexts by deploying to repositories at

## Usage

### Leiningen
### Leiningen 2.x

Add the plugin and repositories listing to `project.clj`:

```clj
:plugins [[s3-wagon-private "1.1.1"]]
:repositories {"releases" "s3p://mybucket/releases/"
"snapshots" "s3p://mybucket/snapshots/"}
```

Versions of Leiningen prior to 1.7.0 don't support `:plugins` in
project.clj; you will need to install by hand:
You can store credentials either in an encrypted file or as
environment variables. For the encrypted file, add this to
`project.clj`:

$ lein plugin install s3-wagon-private 1.1.1
```clj
:repositories {"private" {:url "s3p://mybucket/releases/" :creds :gpg}}
```

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

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

You should keep your S3 credentials in `~/.lein/init.clj`:
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:

```clj
(cemerick.pomegranate.aether/register-wagon-factory!
"s3p" #(eval '(org.springframework.aws.maven.PrivateS3Wagon.)))
```

Future versions should remove the need for this declaration.

### Leiningen 1.x

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

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

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

```clj
(def leiningen-auth {"s3p://mybucket/releases/"
Expand All @@ -33,26 +70,22 @@ You should keep your S3 credentials in `~/.lein/init.clj`:
:passphrase "SECRET_KEY"}})
```

This will allow you to both read and write to/from S3 buckets as Maven
repositories. 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.
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 define `leiningen-auth` in
project.clj after the `defproject` form. However, you should avoid
committing AWS credentials to your project, so you should take them
from the environment using `System/getenv`:
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`:

```clj
(defproject my-project "1.0.0"
:plugins [[s3-wagon-private "1.1.1"]]
:repositories {"releases" "s3p://mybucket/releases/"})

(def leiningen-auth {"s3p://mybucket/releases/"
{:username (System/getenv "AWS_ACCESS_KEY")
:passphrase (System/getenv "SECRET_KEY")}})
:repositories {"releases" {:url "s3p://mybucket/releases/"
:username (System/getenv "AWS_ACCESS_KEY")
:passphrase (System/getenv "AWS_SECRET_KEY")}})
```

### Maven
Expand Down

0 comments on commit 0701fb5

Please sign in to comment.