Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save outofcoffee/f2c6de12b57038fea8747d1856c7539f to your computer and use it in GitHub Desktop.
Save outofcoffee/f2c6de12b57038fea8747d1856c7539f 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