@@ -2,6 +2,7 @@ import java.nio.charset.StandardCharsets
2
2
3
3
plugins {
4
4
id ' java-library'
5
+ id ' maven-publish'
5
6
id ' io.papermc.paperweight.userdev' version ' 1.3.8'
6
7
id ' xyz.jpenilla.run-paper' version ' 1.0.6' // Adds runServer and runMojangMappedServer tasks for testing
7
8
}
@@ -33,6 +34,8 @@ compileJava {
33
34
34
35
java {
35
36
toolchain. languageVersion. set(JavaLanguageVersion . of(17 ))
37
+ withJavadocJar()
38
+ withSourcesJar()
36
39
}
37
40
38
41
assemble {
@@ -71,17 +74,6 @@ dependencies {
71
74
testImplementation ' ch.vorburger.mariaDB4j:mariaDB4j:2.5.3'
72
75
}
73
76
74
-
75
- task sourcesJar (type : Jar ) {
76
- archiveClassifier. set(' sources' )
77
- from sourceSets. main. java. srcDirs
78
- }
79
- task javadocJar (type : Jar , dependsOn : javadoc) {
80
- archiveClassifier. set(' javadoc' )
81
- from javadoc. destinationDir
82
- }
83
-
84
-
85
77
processResources { // modify version string
86
78
filteringCharset = StandardCharsets . UTF_8 . name()
87
79
filesMatching(" **/plugin.yml" ) {
@@ -90,18 +82,28 @@ processResources { // modify version string
90
82
filesMatching(" **/MCVersion" ) {
91
83
expand ' minecraftVersion' : project. minecraftVersion
92
84
}
93
- // from(deobfMappingCsrg) {
94
- // rename { 'spigot-deobf.csrg' }
95
- // }
96
- }
97
- processTestResources {
98
- // from(deobfMappingCsrg) {
99
- // rename { 'spigot-deobf.csrg' }
100
- // }
101
85
}
86
+
102
87
reobfJar {
103
88
outputJar. set(layout. buildDirectory. file(" libs/${ pluginNameUpper} -mc${ minecraftVersion} -${ project.version} .jar" ))
104
89
}
90
+ publishing {
91
+ publications {
92
+ mavenJava(MavenPublication ) {
93
+ from components. java
94
+ afterEvaluate{
95
+ group project. group
96
+ artifactId pluginNameLower
97
+ version " $majorVersion . $minorVersion . $buildNumber -SNAPSHOT"
98
+ }
99
+ }
100
+ }
101
+ repositories {
102
+ maven {
103
+ url mavenDirectory
104
+ }
105
+ }
106
+ }
105
107
106
108
javadoc {
107
109
// javadoc output folder
@@ -112,16 +114,11 @@ javadoc {
112
114
// links 'https://hub.spigotmc.org/javadocs/spigot/'
113
115
links ' https://guava.dev/releases/21.0/api/docs/'
114
116
links ' https://ci.md-5.net/job/BungeeCord/ws/chat/target/apidocs/'
115
-
116
- locale ' en_US'
117
- encoding ' UTF-8'
118
- docEncoding ' UTF-8'
119
- addBooleanOption(' keywords' , true )
120
- addStringOption(' Xdoclint:none' , ' -quiet' )
121
-
117
+ options. locale = ' en_US'
118
+ options. encoding = ' UTF-8'
119
+ options. addBooleanOption(' keywords' , true )
120
+ options. addStringOption(' Xdoclint:none' , ' -quiet' )
122
121
options. addBooleanOption(' html5' , true )
123
-
124
- windowTitle = " ${ pluginNameUpper} Javadoc"
125
- docTitle = " ${ pluginNameUpper} (mc$minecraftVersion -${ project.version} )"
122
+ options. windowTitle = " ${ pluginNameUpper} Javadoc"
126
123
}
127
124
}
0 commit comments