How to use the default AWS credentials chain for an S3 backed Maven repository in a Gradle build?

后端 未结 3 1184
轮回少年
轮回少年 2021-02-14 13:39

According to Gradle documention (Example 50.27), we can use S3 backed Maven repositories with Gradle 2.4. However, the only example given in the docs passes explicit AWS credent

3条回答
  •  一向
    一向 (楼主)
    2021-02-14 13:47

    More recent versions of Gradle provide a built-in way to use credentials from the default provider chain, eg:

    maven {
        url "s3://myCompanyBucket/maven2"
        authentication {
           awsIm(AwsImAuthentication) // load from EC2 role or env var
        }
    }
    

    This avoids the need to manually create an instance of the provider chain and pass in the credential values.

提交回复
热议问题