|
| 1 | +plugins { |
| 2 | + id("java-library") |
| 3 | + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" |
| 4 | + id("maven-publish") |
| 5 | + id("signing") |
| 6 | +} |
| 7 | + |
| 8 | +repositories { |
| 9 | + mavenCentral() |
| 10 | +} |
| 11 | + |
| 12 | +dependencies { |
| 13 | + api(libs.org.purejava.tweetnacl.java) |
| 14 | + api(libs.org.json.json) |
| 15 | + api(libs.org.apache.commons.commons.lang3) |
| 16 | + api(libs.org.slf4j.slf4j.api) |
| 17 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.api) |
| 18 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.engine) |
| 19 | + testImplementation(libs.org.junit.jupiter.junit.jupiter) |
| 20 | + testImplementation(libs.org.slf4j.slf4j.simple) |
| 21 | +} |
| 22 | + |
| 23 | +group = "org.purejava" |
| 24 | +version = "1.2.8-SNAPSHOT" |
| 25 | +description = "A Java library to access KeePassXC via its build-in proxy." |
| 26 | + |
| 27 | +java { |
| 28 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 29 | + withSourcesJar() |
| 30 | + withJavadocJar() |
| 31 | +} |
| 32 | + |
| 33 | +val sonatypeUsername: String = System.getenv("SONATYPE_USERNAME") ?: "" |
| 34 | +val sonatypePassword: String = System.getenv("SONATYPE_PASSWORD") ?: "" |
| 35 | + |
| 36 | +tasks.test { |
| 37 | + useJUnitPlatform() |
| 38 | + filter { |
| 39 | + includeTestsMatching("KeepassProxyAccessTest") |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +publishing { |
| 44 | + publications { |
| 45 | + create<MavenPublication>("mavenJava") { |
| 46 | + from(components["java"]) |
| 47 | + pom { |
| 48 | + name.set("keepassxc-proxy-access") |
| 49 | + description.set("A Java library to access KeePassXC via its build-in proxy.") |
| 50 | + url.set("https://github.com/purejava/keepassxc-proxy-access") |
| 51 | + licenses { |
| 52 | + license { |
| 53 | + name.set("MIT License") |
| 54 | + url.set("https://opensource.org/licenses/MIT") |
| 55 | + } |
| 56 | + } |
| 57 | + developers { |
| 58 | + developer { |
| 59 | + id.set("purejava") |
| 60 | + name.set("Ralph Plawetzki") |
| 61 | + |
| 62 | + } |
| 63 | + } |
| 64 | + scm { |
| 65 | + connection.set("scm:git:git://github.com/purejava/keepassxc-proxy-access.git") |
| 66 | + developerConnection.set("scm:git:ssh://github.com/purejava/keepassxc-proxy-access.git") |
| 67 | + url.set("https://github.com/purejava/keepassxc-proxy-access/tree/main") |
| 68 | + } |
| 69 | + issueManagement { |
| 70 | + system.set("GitHub Issues") |
| 71 | + url.set("https://github.com/purejava/keepassxc-proxy-access/issues") |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +nexusPublishing { |
| 79 | + repositories { |
| 80 | + sonatype { |
| 81 | + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) |
| 82 | + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) |
| 83 | + username.set(sonatypeUsername) |
| 84 | + password.set(sonatypePassword) |
| 85 | + } |
| 86 | + } |
| 87 | +} |
| 88 | + |
| 89 | +if (!version.toString().endsWith("-SNAPSHOT")) { |
| 90 | + signing { |
| 91 | + useGpgCmd() |
| 92 | + sign(configurations.runtimeElements.get()) |
| 93 | + sign(publishing.publications["mavenJava"]) |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +tasks.withType<JavaCompile> { |
| 98 | + options.encoding = "UTF-8" |
| 99 | +} |
| 100 | + |
| 101 | +tasks.withType<Javadoc> { |
| 102 | + options.encoding = "UTF-8" |
| 103 | + if (JavaVersion.current().isJava9Compatible) { |
| 104 | + (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) |
| 105 | + } |
| 106 | +} |
0 commit comments