Skip to content

Commit b38d39f

Browse files
committed
Publish to Maven Central
1 parent 6049ac1 commit b38d39f

File tree

2 files changed

+74
-33
lines changed

2 files changed

+74
-33
lines changed

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,20 @@ e.g.
1212

1313
```groovy
1414
repositories {
15-
maven {
16-
url 'https://oss.sonatype.org/content/repositories/snapshots'
17-
}
15+
mavenCentral()
1816
}
1917
2018
dependencies {
21-
implementation 'net.luckperms:rest-api-java-client:0.1-SNAPSHOT'
19+
implementation 'net.luckperms:rest-api-java-client:0.1'
2220
}
2321
```
2422

2523
```xml
26-
<repositories>
27-
<repository>
28-
<id>sonatype-snapshots</id>
29-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
30-
</repository>
31-
</repositories>
32-
3324
<dependencies>
3425
<dependency>
3526
<groupId>net.luckperms</groupId>
3627
<artifactId>rest-api-java-client</artifactId>
37-
<version>0.1-SNAPSHOT</version>
28+
<version>0.1</version>
3829
</dependency>
3930
</dependencies>
4031
```

build.gradle

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,31 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
77
import org.gradle.api.tasks.testing.logging.TestLogEvent
88

99
group = 'net.luckperms'
10-
version = '0.1-SNAPSHOT'
11-
10+
version = '0.2-SNAPSHOT'
1211

1312
java {
14-
//toolchain {
15-
// languageVersion = JavaLanguageVersion.of(11)
16-
//}
17-
1813
sourceCompatibility = '1.8'
1914
targetCompatibility = '1.8'
2015

2116
withJavadocJar()
2217
withSourcesJar()
2318
}
2419

20+
javadoc {
21+
options.encoding = 'UTF-8'
22+
options.links(
23+
'https://docs.oracle.com/en/java/javase/21/docs/api/',
24+
'https://javadoc.io/static/com.squareup.retrofit2/retrofit/2.8.1/',
25+
'https://javadoc.io/static/com.squareup.okhttp3/okhttp/3.14.9/',
26+
)
27+
}
28+
2529
repositories {
2630
mavenCentral()
2731
}
2832

2933
test {
30-
//onlyIf { project.hasProperty('dockerTests') }
34+
onlyIf { project.hasProperty('dockerTests') }
3135
useJUnitPlatform()
3236
testLogging {
3337
events = [TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED]
@@ -60,20 +64,66 @@ dependencies {
6064
testImplementation 'com.google.guava:guava:32.1.3-jre'
6165
}
6266

63-
publishing {
64-
//repositories {
65-
// maven {
66-
// url = 'https://oss.sonatype.org/content/repositories/snapshots'
67-
// credentials {
68-
// username = sonatypeUsername
69-
// password = sonatypePassword
70-
// }
71-
// }
72-
//}
73-
publications {
74-
mavenJava(MavenPublication) {
75-
from components.java
67+
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {
68+
apply plugin: 'signing'
69+
70+
publishing {
71+
repositories {
72+
maven {
73+
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
74+
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
75+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
76+
77+
credentials {
78+
username sonatypeUsername
79+
password sonatypePassword
80+
}
81+
}
82+
}
83+
84+
publications {
85+
mavenJava(MavenPublication) {
86+
from components.java
87+
88+
pom {
89+
name = 'LuckPerms Rest API Java Client'
90+
description = 'A Java client for the LuckPerms REST API.'
91+
url = 'https://luckperms.net'
92+
93+
licenses {
94+
license {
95+
name = 'MIT'
96+
url = 'https://opensource.org/licenses/MIT'
97+
}
98+
}
99+
100+
developers {
101+
developer {
102+
id = 'lucko'
103+
name = 'Luck'
104+
url = 'https://lucko.me'
105+
106+
}
107+
}
108+
109+
scm {
110+
connection = 'scm:git:https://github.com/LuckPerms/rest-api-java-client.git'
111+
developerConnection = 'scm:git:[email protected]:LuckPerms/rest-api-java-client.git'
112+
url = 'https://github.com/LuckPerms/rest-api-java-client'
113+
}
114+
115+
issueManagement {
116+
system = 'GitHub'
117+
url = 'https://github.com/LuckPerms/rest-api-java-client/issues'
118+
}
119+
}
120+
}
76121
}
77122
}
78-
}
79123

124+
signing {
125+
useGpgCmd()
126+
sign publishing.publications.mavenJava
127+
required = true
128+
}
129+
}

0 commit comments

Comments
 (0)