Skip to content

micartey/yawen

Repository files navigation

yawen

📚 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.

🗳️ Usage

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

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

Load an Asset

Optional<Release> 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");
        // ...
    });
});