A Maven plugin for deploying a p2 update site to an AWS S3 bucket.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Java 1.7+
Maven 3.1.0+
To build the plugin locally, simply run the following:
$ mvn clean install
The aws-p2-maven-plugin is available from Maven Central.
Add the plugin to the build
section of the pom.xml
:
<plugin>
<groupId>com.avojak.mojo</groupId>
<artifactId>aws-p2-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<bucket>p2.example.com</bucket>
</configuration>
<executions>
<execution>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
The plugin will run automatically during the deploy
phase.
Additionally, you may add a pluginGroup
entry to the Maven settings file (User: ${user.home}/.m2/settings.xml
, Global: ${maven.home}/conf/settings.xml
), which will allow the use of aws-p2:*
command line goals interactively in all projects:
<pluginGroups>
<pluginGroup>com.avojak.mojo</pluginGroup>
</pluginGroups>
For example, $ mvn aws-p2:deploy -Daws-p2.bucket=p2.example.com
.
The following goals are available:
Goal | Description |
---|---|
deploy | Deploys the p2 update site |
help | Display help information on the aws-p2-maven-plugin |
The following parameters can be set in the configuration:
Name | Type | Required | Since | Description |
---|---|---|---|---|
bucket | String |
Yes | 1.0 | The name of the S3 bucket where the update site is hosted. User property is: aws-p2.bucket |
deploySnapshots | boolean |
No | 1.0 | Whether or not to deploy snapshot versions. Default value is: true User property is: aws-p2.deploySnapshots |
generateLandingPage | boolean |
No | 1.0 | Whether or not to generate an HTML landing page. This page will be displayed if a user attempts to access the update site via a web browser. No external sources are used in this page, so CORS configuration is not necessary. An example landing page can be found here: p2.avojak.com Default value is: false User property is: aws-p2.generateLandingPage |
projectName | String |
No | 2.0 | The project name that will dictate the root directory of the repository. Default value is: ${project.name} User property is: aws-p2.projectName |
skip | boolean |
No | 1.0 | Set to true to skip plugin execution.Default value is: false User property is: aws-p2.skip |
targetSiteDirectory | String |
No | 1.0 | The directory within the bucket to place the update site. Default value is: ${project.name}/${project.version} User property is: aws-p2.targetSiteDirectory |
The AWS p2 Maven Plugin uses the Default Credential Provider Chain for authentication. See Working with AWS Credentials for details on all supported methods of providing credentials.
In order to host a static p2 update site on an S3 bucket, you will need to ensure several bucket settings:
- In the bucket properties tab, "Static website hosting" must be enabled
- In the bucket permissions tab, "Public access" to list bucket contents must be enabled
It is up to the consumer to configure the AWS account used for deployments, although we recommend creating an account whose sole responsibility is deploying to this bucket. Only the minimum required permissions should be granted to this user.
If versioning is enabled on the bucket, not all versions are deleted during an overwrite. When a new site is uploaded, only current content is deleted, and delete markers are not touched.
- Maven - Dependency Management
- AWS SDK for Java - Used to interact with AWS S3 buckets
- Travis CI - Continuous Integration and Deployment
- JaCoCo - Code Coverage
We use SemVer for versioning. For the versions available, see the tags on this repository.
For more information on the development, check out my blog post.
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details