1+ import org.jreleaser.model.Active
2+
3+ plugins {
4+ `java- library`
5+ `maven- publish`
6+ id(" org.jreleaser" ) version " 1.17.0"
7+ }
8+
9+ group = " io.github.cjmang"
10+ version = " 0.1.20-rc1"
11+
12+ repositories {
13+ mavenCentral()
14+ }
15+
16+ dependencies {
17+ testImplementation(libs.junit.jupiter)
18+
19+ testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
20+
21+ implementation(libs.java.websocket)
22+ implementation(libs.gson)
23+ implementation(libs.httpclient)
24+ implementation(libs.httpcore)
25+ }
26+
27+ // Apply a specific Java toolchain to ease working on different environments.
28+ java {
29+ sourceCompatibility = JavaVersion .VERSION_1_8
30+ targetCompatibility = JavaVersion .VERSION_1_8
31+ toolchain {
32+ languageVersion = JavaLanguageVersion .of(17 )
33+ }
34+ }
35+
36+ val sourcesJar: TaskProvider <Jar > by tasks.registering(Jar ::class ) {
37+ ->
38+ archiveClassifier.set(" sources" )
39+ from(sourceSets.main.get().allSource)
40+ }
41+
42+ val javadocJar: TaskProvider <Jar > by tasks.registering(Jar ::class ) {
43+ ->
44+ dependsOn.add(tasks.javadoc)
45+ archiveClassifier.set(" javadoc" )
46+ from(tasks.javadoc)
47+ }
48+
49+ tasks {
50+ artifacts {
51+ archives(sourcesJar)
52+ archives(javadocJar)
53+ }
54+ }
55+
56+ tasks.withType<JavaCompile >().configureEach {
57+ options.release = 8
58+ }
59+
60+ tasks.named<Test >(" test" ) {
61+ // Use JUnit Platform for unit tests.
62+ useJUnitPlatform()
63+ }
64+
65+ tasks.named<Javadoc >(" javadoc" ) {
66+ options {
67+ (this as CoreJavadocOptions ).addBooleanOption(" Xdoclint:none" , true )
68+ }
69+ }
70+
71+ publishing {
72+ publications {
73+ create<MavenPublication >(" javaClient" ) {
74+ repositories {
75+ // For the time being
76+ mavenLocal()
77+ maven {
78+ url = uri(layout.buildDirectory.dir(" staging-deploy" ))
79+ }
80+ }
81+ pom {
82+ name = " Archipelago Java Library"
83+ description = " Java library to connect to an Archipelago Server"
84+ url = " https://github.com/ArchipelagoMW/Java-Client"
85+ scm {
86+ connection = " scm:git://github.com/ArchipelagoMW/Java-Client"
87+ developerConnection = " scm:git:https://github.com/ArchipelagoMW/Java-Client.git"
88+ url = " https://github.com/ArchipelagoMW/Java-Client"
89+ }
90+ inceptionYear = " 2021"
91+ licenses {
92+ license {
93+ name = " MIT License"
94+ url = " https://github.com/ArchipelagoMW/Java-Client/blob/main/LICENSE"
95+ distribution = " repo"
96+ }
97+ }
98+ developers {
99+ developer {
100+ name = " PlatanoBailando"
101+ 102+ }
103+ developer {
104+ name = " digiholic"
105+ }
106+ }
107+ contributors {
108+ contributor {
109+ name = " Kono Tyran"
110+ roles.add(" Author" )
111+ }
112+ contributor {
113+ name = " mattman107"
114+ }
115+ contributor {
116+ name = " charlesfire"
117+ }
118+ }
119+ }
120+ artifacts {
121+ artifact(tasks.jar)
122+ artifact(sourcesJar)
123+ artifact(javadocJar)
124+ }
125+ }
126+ }
127+ }
128+
129+ jreleaser {
130+ project {
131+ snapshot {
132+ // https://regex101.com/r/TYV89b/1
133+ pattern = " ^[^-]*-(SNAPSHOT|rc.*)"
134+ }
135+ }
136+ signing {
137+ active = Active .ALWAYS
138+ armored = true
139+ }
140+ release {
141+ github {
142+ enabled = true
143+ repoOwner = " ArchipelagoMW"
144+ overwrite = false
145+ skipRelease = true
146+ }
147+ }
148+ deploy {
149+ maven {
150+ mavenCentral {
151+ register(" release-deploy" ) {
152+ // Turning off releases for testing purposes
153+ active = Active .NEVER
154+ applyMavenCentralRules = true
155+ url = " https://central.sonatype.com/api/v1/publisher"
156+ stagingRepository(" build/staging-deploy" )
157+ }
158+ }
159+ nexus2 {
160+ register(" snapshot-deploy" ) {
161+ active = Active .SNAPSHOT
162+ applyMavenCentralRules = true
163+ snapshotSupported = true
164+ closeRepository = true
165+ releaseRepository = true
166+ url = " https://central.sonatype.com/api/v1/publisher"
167+ snapshotUrl = " https://central.sonatype.com/repository/maven-snapshots/"
168+ stagingRepository(" build/staging-deploy" )
169+ }
170+ }
171+ }
172+ }
173+ }
0 commit comments