1+ plugins  { 
2+     id ' java' 
3+     id ' maven-publish' 
4+     id ' com.github.johnrengelman.shadow'   version ' 7.1.0' 
5+ }
6+ 
7+ group ' xyz.theprogramsrc' 
8+ version ' 5.3.1-SNAPSHOT' 
9+ description ' The best way to create a plugin' 
10+ 
11+ repositories {
12+     mavenCentral()
13+     mavenLocal()
14+ 
15+     maven { url ' https://repo.extendedclip.com/content/repositories/placeholderapi/'   }
16+     maven { url ' https://repo.theprogramsrc.xyz/repository/maven-public/'   }
17+     maven { url ' https://oss.sonatype.org/content/repositories/snapshots/'   }
18+     maven { url ' https://oss.sonatype.org/content/repositories/releases/'   }
19+     maven { url ' https://oss.sonatype.org/content/groups/public/'   }
20+     maven { url ' https://hub.spigotmc.org/nexus/content/repositories/snapshots/'   }
21+     maven { url ' https://repo.codemc.org/repository/maven-public'   }
22+     maven { url ' https://repo.codemc.org/repository/nms'   }
23+     maven { url ' https://jitpack.io'   }
24+ }
25+ 
26+ dependencies  {
27+     compileOnly ' org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' 
28+     compileOnly ' org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT' 
29+     compileOnly ' net.md-5:bungeecord-api:1.17-R0.1-SNAPSHOT' 
30+ 
31+     implementation ' com.github.cryptomorin:XSeries:8.4.0' 
32+     implementation ' org.slf4j:slf4j-nop:1.7.32' 
33+     implementation ' org.slf4j:slf4j-api:1.7.32' 
34+     implementation ' commons-io:commons-io:2.11.0' 
35+     implementation ' com.google.code.gson:gson:2.8.9' 
36+     implementation ' me.carleslc.Simple-YAML:Simple-Yaml:1.7.2' 
37+     implementation ' com.zaxxer:HikariCP:3.3.1' 
38+     compileOnly ' org.xerial:sqlite-jdbc:3.25.2' 
39+     implementation ' org.apache.logging.log4j:log4j-api:2.13.2' 
40+     compileOnly ' org.apache.logging.log4j:log4j-core:2.13.2' 
41+     implementation ' net.lingala.zip4j:zip4j:2.9.0' 
42+     compileOnly ' me.clip:placeholderapi:2.10.9' 
43+     implementation ' org.jetbrains:annotations:23.0.0' 
44+ 
45+     testImplementation ' org.junit.jupiter:junit-jupiter:5.7.2' 
46+ }
47+ 
48+ test  {
49+     useJUnitPlatform()
50+ }
51+ 
52+ sourceCompatibility =  1.8 
53+ targetCompatibility =  1.8 
54+ java. withJavadocJar()
55+ java. withSourcesJar()
56+ 
57+ tasks. withType(JavaCompile ) {
58+     options. encoding =  ' UTF-8' 
59+ }
60+ 
61+ tasks. withType(Javadoc ) {
62+     failOnError false 
63+     options. addStringOption(' Xdoclint:none'  , ' -quiet'  )
64+     options. addStringOption(' encoding'  , ' UTF-8'  )
65+     options. addStringOption(' charSet'  , ' UTF-8'  )
66+ }
67+ 
68+ tasks. withType(Copy ) {
69+     duplicatesStrategy =  ' include' 
70+     exclude ' META-INF/**' 
71+ }
72+ 
73+ tasks. withType(Jar ) {
74+     duplicatesStrategy =  ' include' 
75+     exclude ' META-INF/**' 
76+ }
77+ 
78+ shadowJar  { 
79+     relocate ' com.google'  , ' xyz.theprogramsrc.supercoreapi.libs.google' 
80+     relocate ' org.apache.commons'  , ' xyz.theprogramsrc.supercoreapi.libs.apache.commons' 
81+     relocate ' com.cryptomorin.xseries'  , ' xyz.theprogramsrc.supercoreapi.libs.xseries' 
82+     relocate ' org.simpleyaml'  , ' xyz.theprogramsrc.supercoreapi.libs.simpleyaml' 
83+     relocate ' org.yaml.snakeyaml'  , ' xyz.theprogramsrc.supercoreapi.libs.snakeyaml' 
84+     relocate ' org.slf4j'  , ' xyz.theprogramsrc.supercoreapi.libs.slf4j' 
85+     relocate ' net.lingala.zip4j'  , ' xyz.theprogramsrc.supercoreapi.libs.zip4j' 
86+     relocate ' org.checkerframework'  , ' xyz.theprogramsrc.supercoreapi.libs.checkerframework' 
87+     relocate ' org.intellij'  , ' xyz.theprogramsrc.supercoreapi.libs.intellij' 
88+     relocate ' org.jetbrains'  , ' xyz.theprogramsrc.supercoreapi.libs.jetbrains' 
89+     relocate ' javax.annotation'  , ' xyz.theprogramsrc.supercoreapi.libs.annotation' 
90+     relocate ' com.zaxxer.hikari'  , ' xyz.theprogramsrc.supercoreapi.libs.hikari' 
91+ 
92+     archiveBaseName. set(' SuperCoreAPI'  )
93+     archiveClassifier. set(' '  )
94+     archiveVersion. set(' '  )
95+     minimize()
96+ }
97+ 
98+ configurations  {
99+     testImplementation {
100+         extendsFrom(compileOnly)
101+     }
102+ }
103+ 
104+ sourceSets. main. java. srcDir ' src/main/java' 
105+ sourceSets. test. java. srcDir ' src/test/java' 
106+ 
107+ def  repos =  repositories
108+ 
109+ publishing  {
110+     publications {
111+         mavenJava(MavenPublication ) {
112+             artifactId ' SuperCoreAPI' 
113+ 
114+             artifact(tasks[" shadowJar"  ])
115+ 
116+             pom. withXml {
117+                 def  root =  asNode()
118+ 
119+                 root. appendNode(' description'  , description)
120+                 root. appendNode(' packaging'  , ' jar'  )
121+                 root. appendNode(' url'  , ' https://github.com/TheProgramsrc/SuperCoreAPI'  )
122+ 
123+                 final  repositoriesNode =  root. appendNode(' repositories'  )
124+                 repos. each {
125+                     if (it. name ==  ' MavenLocal'  ){
126+                         return 
127+                     }
128+                     def  repositoryNode =  repositoriesNode. appendNode(' repository'  )
129+                     repositoryNode. appendNode(' id'  , it. name)
130+                     repositoryNode. appendNode(' url'  , it. url)
131+                 }
132+ 
133+                 final  dependenciesNode =  root. appendNode(' dependencies'  )
134+                 ext. addDependency =  { dep , String  scope  -> 
135+                     if  (dep. group ==  null  ||  dep. version ==  null  ||  dep. name ==  null  ||  dep. name ==  " unspecified"  )
136+                         return  //  ignore invalid dependencies
137+ 
138+                     final  dependencyNode =  dependenciesNode. appendNode(' dependency'  )
139+                     dependencyNode. appendNode(' groupId'  , dep. group)
140+                     dependencyNode. appendNode(' artifactId'  , dep. name)
141+                     dependencyNode. appendNode(' version'  , dep. version)
142+                     dependencyNode. appendNode(' scope'  , scope)
143+ 
144+                     if  (! dep. transitive) {
145+                         //  If this dependency is not transitive, we should force exclude all its dependencies from the POM
146+                         final  exclusionNode =  dependencyNode. appendNode(' exclusions'  ). appendNode(' exclusion'  )
147+                         exclusionNode. appendNode(' groupId'  , ' *'  )
148+                         exclusionNode. appendNode(' artifactId'  , ' *'  )
149+                     } else  if  (! dep. properties. excludeRules. empty) {
150+                         //  Otherwise add specified exclude rules
151+                         final  exclusionsNode =  dependencyNode. appendNode(' exclusions'  )
152+                         dep. properties. excludeRules. each { rule  -> 
153+                             final  exclusionNode =  exclusionsNode. appendNode(' exclusion'  )
154+                             exclusionNode. appendNode(' groupId'  , rule. group ?:  ' *'  )
155+                             exclusionNode. appendNode(' artifactId'  , rule. module ?:  ' *'  )
156+                         }
157+                     }
158+                 }
159+ 
160+                 configurations. compileOnly. getDependencies(). each { dep  ->  addDependency(dep, " provided"  ) }
161+                 configurations. implementation. getDependencies(). each { dep  ->  addDependency(dep, " compile"  ) }
162+                 configurations. testImplementation. getDependencies(). each { dep  ->  addDependency(dep, " test"  ) }
163+             }
164+         }
165+     }
166+     repositories {
167+         maven {
168+             credentials. username =  System . getenv(' NEXUS_USERNAME'  ) 
169+             credentials. password =  System . getenv(' NEXUS_PASSWORD'  )
170+             url =  uri(version. contains(' -SNAPSHOT'  ) ?  ' https://repo.theprogramsrc.xyz/repository/maven-snapshots/'   :  ' https://repo.theprogramsrc.xyz/repository/maven-releases/'  )
171+         }
172+     }
173+ }
174+ 
175+ javadoc  {
176+     if (JavaVersion . current(). isJava9Compatible()) {
177+         options. addBooleanOption(' html5'  , true )
178+     }
179+ }
180+ 
181+ publish. dependsOn clean, test, jar
0 commit comments