Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexgtn/7138d21e9b9f2f7728aed811ca485c0c to your computer and use it in GitHub Desktop.
Save alexgtn/7138d21e9b9f2f7728aed811ca485c0c to your computer and use it in GitHub Desktop.
Publish a Kotlin module to an S3 Maven repository, using Gradle.
/*
* Publish a Kotlin module to an S3 Maven repository, using Gradle.
* This assumes that the AWS/IAM credentials have 'bucket list' as well as 'object put' and 'object get' permissions.
*/
ext.version_kotlin = '1.0.5-2'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
}
}
repositories {
mavenCentral()
}
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin"
// other dependencies...
}
publishing {
publications {
maven(MavenPublication) {
groupId 'com.example'
artifactId 'example'
version '0.0.1-SNAPSHOT'
from components.java
repositories {
maven {
url 's3://your-s3-bucket/snapshots'
credentials(AwsCredentials) {
accessKey AWS_ACCESS_KEY // put this in gradle.properties
secretKey AWS_SECRET_KEY // put this in gradle.properties
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment