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