89 lines
2.5 KiB
Groovy
89 lines
2.5 KiB
Groovy
// Documentation: https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
|
|
|
|
nexusPublishing {
|
|
repositories {
|
|
sonatype {
|
|
//nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
|
|
//snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
|
|
|
|
def repositoryUsername = project.hasProperty('mavenCentralUsername') ? mavenCentralUsername : "unknown"
|
|
project.logger.info("Setting Maven Central Credentials: ${repositoryUsername}")
|
|
|
|
username = repositoryUsername
|
|
password = project.hasProperty('mavenCentralPassword') ? mavenCentralPassword : "unknown"
|
|
}
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
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
|
|
|
|
// Generate additional Jars
|
|
|
|
task javadocJar(type: Jar) {
|
|
classifier = 'javadoc'
|
|
from javadoc
|
|
}
|
|
|
|
task sourcesJar(type: Jar) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
artifacts {
|
|
archives javadocJar, sourcesJar
|
|
}
|