Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/micartey/yawen

Java runtime dependency loader
https://github.com/micartey/yawen

always-up-to-date classloader dependency java runtime

Last synced: about 2 months ago
JSON representation

Java runtime dependency loader

Awesome Lists containing this project

README

        

# yawen











## :books: Introduction

yawen loads GitHub releases into the Java runtime. With the use of yawen you can keep your application always up-to-date **without any changes** to the end user.

### How does it work?

yawen uses the GitHub-Api to get the releases and all of its assets.
An asset can be loaded through an URLClassLoader and thus contains all classes from that jar.
Only assets that are jar files can be loaded.

## :ballot_box: Usage

First of all, you need to create a new `YawenRepository` object by instanciating it with the GitHub user and repository name: **Username/Repository**

```java
YawenRepository repository = new YawenRepository("Username/Repository");
```

### Load an Asset

```java
Optional optRelease = repository.getLatestRelease();

optRelease.ifPresent(release -> {
Asset asset = Arrays.stream(release.getAssets()).filter(asset -> asset.name.equals("dependency.jar"))
.findFirst()
.orElseThrow(() -> new RuntimeException("No asset found"));

repository.load(asset).ifPresent(classLoader -> {
Class fromRelease = classLoader.loadClass("my.example.project.Class");
// ...
});
});

```