Get AWS credentials for S3 maven repos from default AWS credentials provider chain
Get AWS credentials for S3 maven repos from default AWS credentials provider chain
Gradle now supports S3 maven repos out-of-the-box:
Add this plugin to your project, see https://plugins.gradle.org/plugin/com.github.kaklakariada.awsm-credentials-gradle
plugins {
id "com.github.kaklakariada.awsm-credentials-gradle" version "0.2.1"
}
Configure your AWS credentials as named profiles in ~/.aws/credentials
(not in ~/.aws/config
). Use role_arn
and source_profile
for role delegation:
[root-credentials]
aws_access_key_id = ...
aws_secret_access_key = ...
[delegate-account1]
role_arn = arn
iam::<account>:role/<role name>
source_profile = root-credentials
[delegate-account2]
role_arn = arn
iam::<account>:role/<role name>
source_profile = root-credentials
Configure the AWS profile you want to use in ~/.gradle/gradle.properties
:
systemProp.aws.profile = delegate-account1
Add S3 maven repositories without specifying credentials. The plugin will automatically add credentials for repositories with s3://
urls in all projects.
Dependency repositories:
repositories {
maven {
url "s3://bucket/path/to/repo"
}
}
Publishing repositories:
plugins {
id "maven-publish"
}
publishing {
repositories {
maven {
url "s3://bucket/path/to/repo"
}
}
publications {
// ...
}
}
$ git clone https://github.com/hamstercommunity/awsm-credentials-gradle.git
Import into eclipse using buildship plugin:
$ ./gradlew licenseFormatMain licenseFormatTest
See https://plugins.gradle.org/docs/submit for details.
Add API Key from https://plugins.gradle.org to ~/.gradle/gradle.properties
:
gradle.publish.key = ...
gradle.publish.secret = ...
./gradlew publishPlugins