Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/micartey/yawen
- Owner: micartey
- License: mit
- Created: 2021-07-21T19:12:07.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T20:13:59.000Z (9 months ago)
- Last Synced: 2024-04-28T06:07:00.130Z (8 months ago)
- Topics: always-up-to-date, classloader, dependency, java, runtime
- Language: Java
- Homepage: https://micartey.github.io/yawen/
- Size: 130 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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");
// ...
});
});```