Skip to content

Instantly share code, notes, and snippets.

@DALDEI
Created August 22, 2016 00:43
Show Gist options
  • Save DALDEI/2c8c74f02a0c74d134dc1794fa6d4913 to your computer and use it in GitHub Desktop.
Save DALDEI/2c8c74f02a0c74d134dc1794fa6d4913 to your computer and use it in GitHub Desktop.
s3 gradle repository with instance credentials
// from
// http://stackoverflow.com/questions/35852475/how-to-use-the-default-aws-credentials-chain-for-an-s3-backed-maven-repository-i
apply plugin: 'java'
apply plugin: 'maven-publish'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.amazonaws:aws-java-sdk:1.10.58'
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.acme'
artifactId 'sample-gradle-dependency'
version '1.0'
from components.java
}
}
repositories {
maven {
url "s3://my-bucket/releases"
credentials(AwsCredentials) {
def defaultCredentials = new com.amazonaws.auth.DefaultAWSCredentialsProviderChain().getCredentials()
accessKey defaultCredentials.getAWSAccessKeyId()
secretKey defaultCredentials.getAWSSecretKey()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment