-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
First, you'll need to add the dependency to your project
The artifact you choose will depend on which configuration format you desire. In this example, I'll use YAML which uses the SnakeYaml library.
Maven Example
This would go under your <dependencies>
:
<dependency>
<groupId>space.arim.dazzleconf</groupId>
<artifactId>dazzleconf-ext-snakeyaml</artifactId>
<version>1.0.0</version>
</dependency>
and this under <repositories>
:
<repository>
<id>dazzleconf-repo</i> <!-- Whatever you want to call it -->
<url>https://mvn-repo.arim.space/lesser-gpl3/</url>
</repository>
Gradle Example
dependencies {
implementation 'space.arim.dazzleconf:dazzleconf-ext-snakeyaml:1.0.0'
}
repositories {
maven {
url 'https://mvn-repo.arim.space/lesser-gpl3/'
}
}
In order for your project to work at runtime, you'll need to shade this library using your build system.
With Maven, that would be the maven-shade-plugin. With Gradle, shadowJar.
I won't go over the specifics of shading because it is assumed you already know that.
Relocation
Relocating space.arim.dazzleconf
is important. Always relocate shaded dependencies when there is the possibility of a conflict.
Transitive Dependencies
Depending on the configuration format you use, your build setup may inadvertently shade the configuration format library, such as SnakeYaml or Gson.
In several cases, the configuration library you use is already provided by the environment, and shouldn't be shaded. To fix this, declare the dependency explicitly and set its scope to provided:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
<scope>provided</scope> <!-- Prevents it from being shaded -->
</dependency>