80 lines
No EOL
2.5 KiB
Groovy
80 lines
No EOL
2.5 KiB
Groovy
// Documentation: https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
|
|
// Secrets stored in ~/.jreleaser/config.toml
|
|
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
|
|
publishing {
|
|
repositories {
|
|
maven {
|
|
//def snapshotsRepoUrl = 'http://oss.sonatype.org/content/repositories/snapshots/'
|
|
//def releaseRepoUrl = 'http://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
|
//url = project.hasProperty('release') ? releaseRepoUrl : snapshotsRepoUrl
|
|
url = 'http://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
|
|
|
if (project.hasProperty('mavenCentralUsername') && project.hasProperty('mavenCentralPassword')) {
|
|
credentials {
|
|
username mavenCentralUsername
|
|
password mavenCentralPassword
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
groupId = 'se.koc'
|
|
artifactId = 'zutil'
|
|
from components.java
|
|
|
|
pom {
|
|
name = 'Zutil'
|
|
description = 'A library containing utility classes and code snippets.'
|
|
url = 'https://github.com/Ziver/zutil'
|
|
|
|
licenses {
|
|
license {
|
|
name = 'MIT License'
|
|
url = 'http://www.opensource.org/licenses/mit-license.php'
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = 'Ziver Koc'
|
|
name = 'dev@koc.se'
|
|
}
|
|
}
|
|
scm {
|
|
connection = 'scm:git:https://github.com/Ziver/zutil.git'
|
|
developerConnection = 'scm:git:https://repo.koc.se/zutil-java.git'
|
|
url = 'https://github.com/Ziver/zutil'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Signing
|
|
|
|
signing {
|
|
required { hasProperty("signing.secretKeyRingFile") }
|
|
sign publishing.publications.mavenJava
|
|
}
|
|
|
|
// Generate version.txt
|
|
|
|
ext.genOutputDir = file("${buildDir}/generated-resources")
|
|
|
|
task generateVersionTxt() {
|
|
ext.outputFile = file("${genOutputDir}/version.txt")
|
|
outputs.file(outputFile)
|
|
doLast {
|
|
outputFile.text = """GroupId: ${project.group}
|
|
Name: ${project.name}
|
|
Version: ${version}
|
|
Build-time: ${java.time.LocalDateTime.now()}
|
|
"""
|
|
}
|
|
}
|
|
|
|
sourceSets.main.output.dir genOutputDir, builtBy: generateVersionTxt |