Skip to content

Instantly share code, notes, and snippets.

@amartinj
Last active May 23, 2019 11:26
Show Gist options
  • Save amartinj/62ddf45860cf077f2306f2ba1beb404c to your computer and use it in GitHub Desktop.
Save amartinj/62ddf45860cf077f2306f2ba1beb404c to your computer and use it in GitHub Desktop.
Basic gradle file (kotlin)
group = "net.sek.lib"
version = "1.0-SNAPSHOT"
plugins {
`maven-publish`
kotlin("jvm") version "1.3.31"
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
}
publishing {
val mavenUser: String by project
val mavenPassword: String by project
val baseRepo: String by project
publications {
create<MavenPublication>("default") {
from(components["java"])
}
}
repositories {
maven {
credentials {
username = mavenUser
password = mavenPassword
}
url = when {
(version as String).endsWith("SNAPSHOT") -> uri("$baseRepo/maven-snapshots")
else -> uri("$baseRepo/maven-releases")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment