Heretere's Dependency Loader is a runtime maven dependency handler. It has powered using a Gradle plugin to make solving transitive dependencies simple.
Certain websites have capped jar sizes, this library allows you to supply a much smaller jar size without sacrificing the amount of libraries you use in your project.
- Automatically downloads, and loads maven dependencies at runtime
- Easily create your own runtime dependency types on top of Maven
- Downloads are cached to your plugin's data folder or to a different specified directory
- Relocation isn't required since files are loaded into an isolated classloader
- All Maven repos
plugins {
id("com.heretere.hdl.plugin") version "2.0.0"
}
dependencies {
// instead of implementation("com.google.guava:guava:31.0-jre")
hdl("com.google.guava:guava:31.0-jre")
}
The plugin will automatically include the core dependency so you can invoke it at runtime.
import com.heretere.hdl.impl.DependencyLoader;
public class Main {
public static void main(String[] args) {
DependencyLoader loader = new DependencyLoader(/*Define a dependency directory path here*/);
boolean success = loader.loadDependencies();
if (!success) {
throw new RuntimeException("Failed to load dependencies")
//dependencies successfully loaded
}
}
}
Usage without Gradle plugin
Maven
<!-- Just the Core -->
<dependency>
<groupId>com.heretere.hdl</groupId>
<artifactId>core</artifactId>
<version>Version</version>
</dependency>
<!-- Spigot Version -->
<dependency>
<groupId>com.heretere.hdl</groupId>
<artifactId>bukkit</artifactId>
<version>Version</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
//Just the Core
dependencies {
implementation 'com.heretere.hdl:core:Version'
}
//Spigot Version
dependencies {
implementation 'com.heretere.hdl:bukkit:Version'
}