This project supports the article [http://www.kdgregory.com/index.php?page=maven.s3Deploy]. It contains the following components, which are described in detail below:
AWS: configuration for AWS; sub-directories are named after the AWS service.
Deployed-Project: a simple Maven project that will be deployed to S3.
Consuming-Project: a simple Maven project that depends on the previous project.
settings.xml: example Maven settings to read from a repository server. This is adapted from the Nexus Repository Manager documentation.
scripts: some utility scripts to configure projects for those following along at home (these are all Linux bash scripts; if you don't use Linux you're on your own).
Building the sample projects
- You've configured AWS and Nexus as described in the article.
You can find example policy documents and the Lambda source code in the
AWSsub-directory, but you'll need to change any references to
example.comto your own domain.
- A JDK (not JRE!). The version shouldn't matter; on Ubuntu I install
- A recent version of Maven. At this time Ubuntu installs 3.0.5, which is rather old; you can download the latest version from maven.apache.org.
Now for the manual steps to do in this directory:
- Remove the
.gitdirectory from this working directory. It's not needed (you won't be checking stuff back in), and sometimes Git gets confused when it has nested repositories. Since this is a destructive action, I want you to do it explicitly.
- Edit the file
settings.xmlto change the repository URL, and move it into
$HOME/.m2(after backing-up any existing settings file that you might have!).
- Change the
Deployed-Project/pom.xmlto point to your own bucket. Your releases will fail if you leave it pointing at mine.
- Run the script
scripts/setup-projects.sh, which moves the directory
/tmp, turns it into a Git "remote" repository, and clones it back to the project directory. This is necessary for the Maven release plugin to work.
Now you're ready to run
mvn release on
Deployed_Project. You should see the files being uploaded to S3.
And assuming that your Nexus server is up and running, you should be able to run
mvn test in
Consuming-Project, and see it download the snapshot from Nexus.