S3 Maven repository with Gradle(kotlin)
One of basic TODO for the development team is setting a private remote maven repository for us to upload and download own dependencies. Here are things to know and consider.
- Minimize bolierplate in build.gradle script with initscript.
place init.gradle.kts into ~/.gradle/ or one of directories specified here.
Furthermore you may on also want to setup custom gradle distribution with gralde wrapper, however, if you stored your gradle distribution in non public s3, as gradle wrapper only support http and https not s3, you have to provide your local and build environment are capable of accessing your private s3 with http(ACL by IP rages etc).
2. Secure your AWS accessKey and secretKey out of your script.
As you can see the script thanks to gradle’s AwsImAuthentication you don’t need to specify accessKey and secretKey to access s3 in your gradle script neither in your local nor remote build environment.
on local development environment still you need make sure you store your credentials in local directory, ~/.aws/credentials which will be created once you do “aws configure”
right policy with proper permissions for the role you are using at Codebuild and AWS user using at local.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": "*"
}
]
}