Skip to content

Commit fd5d8c5

Browse files
authored
fix/improve publishing (#3350)
1 parent 0256953 commit fd5d8c5

File tree

3 files changed

+82
-27
lines changed

3 files changed

+82
-27
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,3 @@ logs/
181181
build/
182182
logs/
183183
.java-version
184-
gradle.properties

build.gradle.kts

+81-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2-
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
32
import io.github.patrick.gradle.remapper.RemapTask
3+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
44

55
plugins {
66
`java-library`
@@ -10,7 +10,6 @@ plugins {
1010
}
1111

1212
group = "com.comphenix.protocol"
13-
version = "5.4.0-SNAPSHOT"
1413
description = "Provides access to the Minecraft protocol"
1514

1615
val mcVersion = "1.21.4"
@@ -69,30 +68,6 @@ dependencies {
6968
java {
7069
sourceCompatibility = JavaVersion.VERSION_17
7170
targetCompatibility = JavaVersion.VERSION_17
72-
73-
withJavadocJar()
74-
withSourcesJar()
75-
}
76-
77-
publishing {
78-
publications.withType<MavenPublication> {
79-
artifactId = "ProtocolLib"
80-
}
81-
82-
repositories {
83-
maven {
84-
url = if (isSnapshot) {
85-
uri("https://repo.dmulloy2.net/repository/snapshots/")
86-
} else {
87-
uri("https://repo.dmulloy2.net/repository/releases/")
88-
}
89-
90-
credentials {
91-
username = System.getenv("NEXUS_USERNAME")
92-
password = System.getenv("NEXUS_PASSWORD")
93-
}
94-
}
95-
}
9671
}
9772

9873
tasks {
@@ -145,4 +120,84 @@ tasks {
145120
compileJava {
146121
options.encoding = "UTF-8"
147122
}
123+
124+
register<org.gradle.jvm.tasks.Jar>("javadocJar") {
125+
archiveClassifier.set("javadoc")
126+
from(getByName("javadoc"))
127+
}
128+
129+
register<org.gradle.jvm.tasks.Jar>("sourcesJar") {
130+
archiveClassifier.set("sources")
131+
from(project.the<JavaPluginExtension>().sourceSets["main"].allJava)
132+
}
133+
}
134+
135+
publishing {
136+
publications {
137+
create<MavenPublication>("maven") {
138+
from(components["java"])
139+
artifact(tasks.getByName("sourcesJar"))
140+
artifact(tasks.getByName("javadocJar"))
141+
142+
pom {
143+
name.set(project.name)
144+
description.set(project.description)
145+
url.set("https://github.com/dmulloy2/ProtocolLib")
146+
147+
developers {
148+
developer {
149+
id.set("dmulloy2")
150+
name.set("Dan Mulloy")
151+
url.set("https://dmulloy2.net/")
152+
}
153+
developer {
154+
id.set("aadnk")
155+
email.set("[email protected]")
156+
name.set("Kristian S. Stangeland")
157+
url.set("https://comphenix.net/")
158+
}
159+
}
160+
161+
licenses {
162+
license {
163+
name.set("GNU GENERAL PUBLIC LICENSE - Version 2, June 1991")
164+
url.set("https://www.gnu.org/licenses/gpl-2.0.txt")
165+
distribution.set("repo")
166+
}
167+
}
168+
169+
scm {
170+
tag.set("HEAD")
171+
url.set("https://github.com/dmulloy2/ProtocolLib")
172+
connection.set("scm:git:git://github.com/dmulloy2/ProtocolLib.git")
173+
developerConnection.set("scm:git:[email protected]:dmulloy2/ProtocolLib.git")
174+
}
175+
176+
issueManagement {
177+
system.set("GitHub Issues")
178+
url.set("https://github.com/dmulloy2/ProtocolLib/issues")
179+
}
180+
181+
ciManagement {
182+
system.set("Jenkins")
183+
url.set("https://ci.dmulloy2.net/job/ProtocolLib")
184+
}
185+
}
186+
}
187+
}
188+
189+
repositories {
190+
maven {
191+
url = if (isSnapshot) {
192+
uri("https://repo.dmulloy2.net/repository/snapshots/")
193+
} else {
194+
uri("https://repo.dmulloy2.net/repository/releases/")
195+
}
196+
197+
credentials {
198+
username = System.getenv("NEXUS_USERNAME")
199+
password = System.getenv("NEXUS_PASSWORD")
200+
}
201+
}
202+
}
148203
}

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version=5.4.0-SNAPSHOT

0 commit comments

Comments
 (0)