diff --git a/build.gradle b/build.gradle index b38b478..a6cd498 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,12 @@ plugins { id 'java-library' + id 'maven-publish' + id 'signing' } group = 'xyz.chaofan.solon' version = '1.0.0' +description = 'solon-detector-prometheus is a Prometheus monitoring plug-in based on the Solon framework.' repositories { mavenCentral() @@ -14,14 +17,70 @@ dependencies { implementation 'org.noear:solon' implementation 'org.slf4j:slf4j-api' implementation 'io.micrometer:micrometer-registry-prometheus:1.11.5' - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' } -test { - useJUnitPlatform() -} artifacts { archives jar } + +java { + withJavadocJar() + withSourcesJar() +} + +javadoc { + options.addStringOption("charset", "UTF-8") + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'solon-detector-prometheus' + from components.java + pom { + name = project.name + description = description + url = 'https://github.com/chaofanx/solon-detector-prometheus' + licenses { + license { + name = 'Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'chaofanx' + name = 'chaofanx' + email = '915669640@qq.com' + } + } + scm { + connection = 'scm:git:git://github.com/chaofanx/solon-detector-prometheus' + developerConnection = 'scm:git:ssh://github.com/chaofanx/solon-detector-prometheus.git' + url = 'https://github.com/chaofanx/solon-detector-prometheus' + } + } + } + } + repositories { + maven { + name = "OSSRH" + if (project.version.toString().endsWith("-SNAPSHOT")) { + url = "https://s01.oss.sonatype.org/content/repositories/snapshots" + } else { + url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + } + credentials { + username = findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") + password = findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") + } + } + } +} + +signing { + sign(publishing.publications.mavenJava) +}