Downloading Dependences From Private Amazon S3 Repository with Gradle

蓝咒 提交于 2019-12-03 12:48:11

Gradle 2.4 has native support for S3 repositories. Both downloading dependencies and publishing artifacts.

To download with IAM credentials (paraphrased from the link above):

repositories {
    maven {
        url "s3://someS3Bucket/path/to/repo/root"
        credentials(AwsCredentials) {
            accessKey 'access key'
            secretKey 'secret key'
        }
    }
}

Then specify your dependencies as usual.

You don't need any custom repository support to make this work. Just declare a maven repository with the correct URL. If the repository works when used from Maven, it will also work with Gradle. (Uploading may be a different matter.)

You can use S3 and http

repositories {
    mavenCentral()
    ivy {
        url "https://s3-eu-west-1.amazonaws.com/my-bucket"
        layout "pattern", {
            artifact "[artifact]-[revision].[ext]"
            m2compatible = true
        }
    }
}

Name the jar in S3 to name-rev.jar (joda-time-3.2.jar) in my-bucket. Also upload a pom file. And in S3 give all permission to Download the jar and pom.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!