Giter Site home page Giter Site logo

hdl's Introduction

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'
}

hdl's People

Contributors

conclube avatar heretere avatar alfiejfs avatar zofiaclient avatar robertlit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.