Heretere's Dependency Loader

Runtime dependency loading library

License

License

GroupId

GroupId

com.heretere.hdl
ArtifactId

ArtifactId

hdl-core
Last Version

Last Version

1.5.1
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

Heretere's Dependency Loader
Runtime dependency loading library
Project URL

Project URL

https://github.com/heretere/hdl
Source Code Management

Source Code Management

https://github.com/heretere/hdl

Download hdl-core

Dependencies

compile (1)

Group / Artifact Type Version
org.jetbrains : annotations jar 20.1.0

Project Modules

There are no modules declared in this project.

Heretere's Dependency Loader

Maven Central Lines of code GitHub code size in bytes GitHub license

Description

Heretere's Dependency Loader is a runtime dependency loader for spigot plugins. You can easily declare maven dependencies using annotations. You can easily define a repository URL and jar relocations with annotations as well.

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, relocates, 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

Currently, Supported Dependency Types


Examples

Here is an example main class to show you want it looks like to declare config dependencies.

import com.heretere.hdl.dependency.maven.annotation.MavenDependencytion.Maven;
import com.heretere.hdl.dependency.maven.annotation.MavenRepository;
import com.heretere.hdl.relocation.annotation.Relocation;

// MavenCentral is included by default so you don't need to declare it
@MavenRepository("https://jitpack.io")
// Transitive dependencies are not supported so you need to declare any dependencies to be downloaded
@MavenDependency("com|github|heretere:hch:v1.0.10")
// You can also declare dependencies in block style
@MavenDependency(groupId = "org|tomlj", artifactId = "tomlj", version = "1.0.0")
// You can define your own custom separator as well, the separator can't contain a . or /
// This is to ensure compatibility with maven and gradle relocation
@MavenDependency(value = "org{}antlr:antlr4-runtime:4.7.2", separator = "{}")
// Make sure to define your relocations in your maven/gradle file as well.
@Relocation(from = "com|heretere|hch", to = "com|myplugin|libs|hch")
@Relocation(from = "org|tomlj", to = "com|myplugin|libs|tomlj")
// You can define your own custom separator as well
@Relocation(from = "org{}antlr", to = "com{}myplugin{}libs{}antlr", separator = "{}")

// DependencyPlugin extends JavaPlugin, it ensures that any dependencies are downloaded and loaded before your
// methods are called.
public final class Test extends DependencyPlugin {
    @Override public void load() {

    }

    @Override public void enable() {

    }

    @Override public void disable() {

    }
}

You don't have to extend DependencyPlugin all you need to do is create a new instance of com.heretere.hdl.DependencyEngine and supply your class to load dependencies. Check more examples here.


Usage

HDL is located on maven central.

Maven
<!-- Just the Core -->
<dependency>
    <groupId>com.heretere.hdl</groupId>
    <artifactId>hdl-core</artifactId>
    <version>Version</version>
</dependency>
<!-- Spigot Version -->
<dependency>
    <groupId>com.heretere.hdl</groupId>
    <artifactId>hdl-spigot</artifactId>
    <version>Version</version>
</dependency>
Gradle
repositories {
    mavenCentral()
}
//Just the Core
dependencies {
    implementation 'com.heretere.hdl:hdl-core:Version'
}
//Spigot Version
dependencies {
    implementation 'com.heretere.hdl:hdl-spigot:Version'
}

Versions

Version
1.5.1
1.5.0
1.4.3
1.4.2
1.4.1
1.4.0
1.3.1