-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
101 lines (87 loc) · 3.15 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
plugins {
id("java-library")
id 'maven-publish' // https://docs.gradle.org/current/userguide/publishing_maven.html
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("signing")
//id("com.diffplug.spotless") version "7.0.0.BETA4"
}
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/net.jodah/typetools
implementation group: 'net.jodah', name: 'typetools', version: '0.6.3'
testImplementation("org.assertj:assertj-core:3.11.1")
testImplementation(platform('org.junit:junit-bom:5.11.3'))
testImplementation('org.junit.jupiter:junit-jupiter')
testRuntimeOnly('org.junit.platform:junit-platform-launcher')
}
java {
setSourceCompatibility(JavaVersion.VERSION_1_8)
setTargetCompatibility(JavaVersion.VERSION_1_8)
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
// https://github.com/gradle-nexus/publish-plugin/?tab=readme-ov-file#publishing-to-maven-central-via-sonatype-ossrh
nexusPublishing {
repositories {
// the user token is set outside the project
// https://central.sonatype.org/publish/generate-token/
sonatype()
}
}
//Auxiliary jar files required by Maven module publications
tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
//TODO: java.withSourcesJar(), java.withJavadocJar()
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
// https://stackoverflow.com/a/52208921
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
publishing { //https://docs.gradle.org/current/userguide/publishing_maven.html
publications {
mavenJava(MavenPublication) { //name of the publication
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name.set("JMXBuilder")
description.set("JMXBuilder")
url.set("https://github.com/tersesystems/jmxbuilder")
licenses {
license {
name.set("Apache2")
url.set("https://github.com/tersesystems/jmxbuilder/blob/main/LICENSE")
}
}
developers {
developer {
id.set("wsargent")
name.set("Will Sargent")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:https://github.com/tersesystems/jmxbuilder.git")
developerConnection.set("scm:git:https://github.com/tersesystems/jmxbuilder.git")
url.set("https://github.com/tersesystems/jmxbuilder.git")
}
}
}
}
}
ext.isReleaseVersion = ! project.version.endsWith("SNAPSHOT")
signing { // https://docs.gradle.org/current/userguide/signing_plugin.html
required { isReleaseVersion && gradle.taskGraph.hasTask("publishToSonatype") }
sign publishing.publications.mavenJava
}