@@ -35,7 +35,7 @@ defaultTasks("clean", "build")
3535allprojects {
3636 version = " 3.0.0-SNAPSHOT"
3737 group = " io.github.juliarn"
38- description = " Abstract NPC-Library for Minecraft 1.8+ Servers"
38+ description = " NPC-Library for Minecraft 1.8+ Servers"
3939
4040 repositories {
4141 mavenCentral()
@@ -68,7 +68,6 @@ allprojects {
6868}
6969
7070subprojects {
71- // apply all plugins only to subprojects
7271 apply (plugin = " signing" )
7372 apply (plugin = " checkstyle" )
7473 apply (plugin = " java-library" )
@@ -79,11 +78,6 @@ subprojects {
7978 " compileOnly" (rootProject.libs.annotations)
8079 }
8180
82- configurations.all {
83- // unsure why but every project loves them, and they literally have an import for every letter I type - beware
84- exclude(" org.checkerframework" , " checker-qual" )
85- }
86-
8781 tasks.withType<Jar > {
8882 from(rootProject.file(" license.txt" ))
8983 duplicatesStrategy = DuplicatesStrategy .INCLUDE
@@ -109,6 +103,9 @@ subprojects {
109103 }
110104
111105 extensions.configure<JavaPluginExtension > {
106+ withSourcesJar()
107+ withJavadocJar()
108+
112109 disableAutoTargetJvm()
113110 toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
114111 }
@@ -131,37 +128,26 @@ subprojects {
131128
132129 tasks.withType<Javadoc > {
133130 val options = options as ? StandardJavadocDocletOptions ? : return @withType
134-
135- // options
136131 options.encoding = " UTF-8"
137132 options.memberLevel = JavadocMemberLevel .PRIVATE
138133 options.addStringOption(" -html5" )
139134 options.addBooleanOption(" Xdoclint:-missing" , true )
140135 }
141136
142- tasks.register< org.gradle.jvm.tasks.Jar > (" javadocJar" ) {
143- archiveClassifier.set(" javadoc" )
144- from(tasks.getByName(" javadoc" ))
145- }
146-
147- tasks.register< org.gradle.jvm.tasks.Jar > (" sourcesJar" ) {
148- archiveClassifier.set(" sources" )
149- from(project.the<SourceSetContainer >()[" main" ].allJava)
150- }
151-
152137 extensions.configure<PublishingExtension > {
138+ val projectName = project.name
139+ val projectDescription = project.description
140+ val projectRepos = project.repositories
141+ .filterIsInstance<MavenArtifactRepository >()
142+ .filter { it.url.scheme == " https" }
143+ .map { Pair (it.name, it.url.toString()) }
144+
153145 publications.apply {
154- create(" maven" , MavenPublication ::class .java).apply {
155- // main output to publish
146+ register<MavenPublication >(" maven" ) {
156147 from(components.getByName(" java" ))
157-
158- // additional artifacts
159- artifact(tasks.getByName(" sourcesJar" ))
160- artifact(tasks.getByName(" javadocJar" ))
161-
162148 pom {
163- name.set(project.name )
164- description.set(project.description )
149+ name.set(projectName )
150+ description.set(projectDescription )
165151 url.set(" https://github.com/juliarn/NPC-Lib" )
166152
167153 licenses {
@@ -191,20 +177,18 @@ subprojects {
191177 developers {
192178 developer {
193179 id.set(" derklaro" )
194- email.set(" git @derklaro.dev" )
180+ email.set(" me @derklaro.dev" )
195181 timezone.set(" Europe/Berlin" )
196182 name.set(" Pasqual Koschmieder" )
197183 }
198184 }
199185
200186 withXml {
201187 val repositories = asNode().appendNode(" repositories" )
202- project.repositories.forEach {
203- if (it is MavenArtifactRepository && it.url.toString().startsWith(" https://" )) {
204- val repo = repositories.appendNode(" repository" )
205- repo.appendNode(" id" , it.name)
206- repo.appendNode(" url" , it.url.toString())
207- }
188+ projectRepos.forEach {
189+ val repo = repositories.appendNode(" repository" )
190+ repo.appendNode(" id" , it.first)
191+ repo.appendNode(" url" , it.second)
208192 }
209193 }
210194 }
@@ -213,15 +197,20 @@ subprojects {
213197 }
214198
215199 tasks.withType<Sign > {
200+ val projectVersion = rootProject.version.toString()
216201 onlyIf {
217- ! rootProject.version.toString() .endsWith(" -SNAPSHOT" )
202+ ! projectVersion .endsWith(" -SNAPSHOT" )
218203 }
219204 }
220205
221206 extensions.configure<SigningExtension > {
222207 useGpgCmd()
223208 sign(extensions.getByType(PublishingExtension ::class .java).publications.getByName(" maven" ))
224209 }
210+
211+ configurations.all {
212+ exclude(" org.checkerframework" , " checker-qual" )
213+ }
225214}
226215
227216nexusPublishing {
0 commit comments