Created
August 22, 2016 00:43
-
-
Save DALDEI/2c8c74f02a0c74d134dc1794fa6d4913 to your computer and use it in GitHub Desktop.
s3 gradle repository with instance credentials
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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