· 6 years ago · Mar 08, 2019, 04:36 AM
1/*
2 * Publish a Kotlin module to an S3 Maven repository, using Gradle.
3 * This assumes that the AWS/IAM credentials have 'bucket list' as well as 'object put' and 'object get' permissions.
4 */
5
6ext.version_kotlin = '1.0.5-2'
7
8buildscript {
9 repositories {
10 mavenCentral()
11 }
12 dependencies {
13 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
14 }
15}
16
17repositories {
18 mavenCentral()
19}
20
21apply plugin: 'kotlin'
22apply plugin: 'maven-publish'
23
24dependencies {
25 compile "org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin"
26
27 // other dependencies...
28}
29
30publishing {
31 publications {
32 maven(MavenPublication) {
33 groupId 'com.example'
34 artifactId 'example'
35 version '0.0.1-SNAPSHOT'
36 from components.java
37
38 repositories {
39 maven {
40 url 's3://your-s3-bucket/snapshots'
41 credentials(AwsCredentials) {
42 accessKey AWS_ACCESS_KEY // put this in gradle.properties
43 secretKey AWS_SECRET_KEY // put this in gradle.properties
44 }
45 }
46 }
47 }
48 }
49}