hdl

Heretere's Dependency Loader

MIT License

Stars
8
Committers
6

Heretere's Dependency Loader

Description

Heretere's Dependency Loader is a runtime maven dependency handler. It has powered using a Gradle plugin to make solving transitive dependencies simple.

Why?

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.

Documentation


Features

  • 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

Currently, Supported Dependency Types

  • All Maven repos

Examples

Gradle Plugin

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.

Main Class

	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

Usage without Gradle plugin

<!-- 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>
repositories {
    mavenCentral()
}
//Just the Core
dependencies {
    implementation 'com.heretere.hdl:core:Version'
}
//Spigot Version
dependencies {
    implementation 'com.heretere.hdl:bukkit:Version'
}
Package Rankings
Top 29.74% on Repo1.maven.org
Related Projects