# DependencyLoader

The dependency loader system is a great way to load some of your dependencies into runtime without needing to shade them into your final jar, thus reducing the file size of your finalized jar. For example, using the dependency loader to load database drivers instead of shading them into your jar would reduce the file size of your finalized jar by hundreds of kilobytes or, in some cases, megabytes.

There are two primary ways of accessing and using the dependency loader.

### Main Class

Using your plugin's main class, which should extend <mark style="color:green;">`AluminaPlugin`</mark>, a built-in method allows you to load a dependency.

<details>

<summary>Example</summary>

```java
public class ExamplePlugin extends AluminaPlugin {

    @Override
    public void load() {
        // Loads the SQLite database driver
        loadDependency("org.xerial", "sqlite-jdbc", "3.34.0");
    }

    @Override
    public void enable() {

    }

    @Override
    public void disable() {

    }
    
}
```

</details>

### Using the DependencyLoader class

You can also directly load a dependency using the <mark style="color:blue;">`DependencyLoader`</mark> class itself using one of the static methods.

<details>

<summary>Example</summary>

```java
public class ExamplePlugin extends AluminaPlugin {

    @Override
    public void load() {
        // Loads the SQLite database driver using the DependencyLoader
        DependencyLoader.loadDependency(this, "org.xerial", "sqlite-jdbc", "3.34.0");
    }

    @Override
    public void enable() {

    }

    @Override
    public void disable() {

    }

}
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.ericlmao.com/projects/alumina/dependencyloader.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
