Setup
Pick your poison.
Choose the modules you need
Pick one of our platform modules.
bukkit
bungee
kotlin
And at least one of our serializer modules (according to your preferred file type).
hocon
json
yaml
Add the library modules as a dependency
repositories {
maven { url = 'https://jitpack.io' }
}
dependencies {
// replace 'bukkit' with artifact name
implementation 'com.github.secretx33.sc-cfg:bukkit:main-SNAPSHOT'
}
repositories {
maven("https://jitpack.io")
}
dependencies {
// replace 'bukkit' with artifact name
implementation("com.github.secretx33.sc-cfg:bukkit:main-SNAPSHOT")
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.secretx33.sc-cfg</groupId>
<!-- Replace 'bukkit' with the artifact name -->
<artifactId>bukkit</artifactId>
<version>main-SNAPSHOT</version>
</dependency>
</dependencies>
Relocate the library
This step is very important, sc-cfg won't work properly if you don't relocate it!
Variable yourPackage
is just a suggestion for your package of dependencies, you can of course use another one.
plugins {
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
shadowJar {
def yourPackage = "${project.group}.dependencies.${project.name}"
relocate "com.github.secretx33.sccfg", "${yourPackage}.sccfg"
// these are all transitive dependencies, added here as convenience
relocate "com.cryptomorin.xseries", "${yourPackage}.xseries"
relocate "com.typesafe.config", "${yourPackage}.typesafe.config"
relocate "io.leangen.geantyref", "${yourPackage}.geantyref"
relocate "javassist", "${yourPackage}.javassist"
relocate "javax.annotation", "${yourPackage}.javax.annotation"
relocate "org.reflections", "${yourPackage}.reflections"
relocate "org.slf4j", "${yourPackage}.slf4j"
relocate "org.spongepowered.configurate", "${yourPackage}.configurate"
relocate "org.yaml.snakeyaml", "${yourPackage}.snakeyaml"
}
Variable yourPackage
is just a suggestion for your package of dependencies, you can of course use another one.
plugins {
id("com.github.johnrengelman.shadow") version "7.0.0"
}
tasks.shadowJar {
val yourPackage = "${project.group}.dependencies.${project.name}"
relocate("com.github.secretx33.sccfg", "${yourPackage}.sccfg")
// these are all transitive dependencies, added here as convenience
relocate("com.cryptomorin.xseries", "${yourPackage}.xseries")
relocate("com.typesafe.config", "${yourPackage}.typesafe.config")
relocate("io.leangen.geantyref", "${yourPackage}.geantyref")
relocate("javassist", "${yourPackage}.javassist")
relocate("javax.annotation", "${yourPackage}.javax.annotation")
relocate("org.reflections", "${yourPackage}.reflections")
relocate("org.slf4j", "${yourPackage}.slf4j")
relocate("org.spongepowered.configurate", "${yourPackage}.configurate")
relocate("org.yaml.snakeyaml", "${yourPackage}.snakeyaml")
}
Replace [yourPackage]
with your package for dependencies, e.g. me.myplugin.plugin.dependencies
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.github.secretx33.sccfg</pattern>
<shadedPattern>[yourPackage].sccfg</shadedPattern>
</relocation>
<!-- transitive dependencies added here for convenience -->
<relocation>
<pattern>com.cryptomorin.xseries</pattern>
<shadedPattern>[yourPackage].xseries</shadedPattern>
</relocation>
<relocation>
<pattern>com.typesafe.config</pattern>
<shadedPattern>[yourPackage].typesafe.config</shadedPattern>
</relocation>
<relocation>
<pattern>io.leangen.geantyref</pattern>
<shadedPattern>[yourPackage].geantyref</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>[yourPackage].javassist</shadedPattern>
</relocation>
<relocation>
<pattern>javax.annotation</pattern>
<shadedPattern>[yourPackage].javax.annotation</shadedPattern>
</relocation>
<relocation>
<pattern>org.reflections</pattern>
<shadedPattern>[yourPackage].reflections</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>[yourPackage].slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>org.spongepowered.configurate</pattern>
<shadedPattern>[yourPackage].configurate</shadedPattern>
</relocation>
<relocation>
<pattern>org.yaml.snakeyaml</pattern>
<shadedPattern>[yourPackage].snakeyaml</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Last updated