A runtime maven dependency loader.
- Annotation based
- Artifacts locally saved to faster loading
- Java 1.8+
Add Javen as a project dependency
<repositories>
<repository>
<url>https://repo.cyr1en.com/snapshots</url>
</repository>
</repositories>
<dependency>
<groupId>com.cyr1en</groupId>
<artifactId>javen-core</artifactId>
<version>{version}</version>
</dependency>
repositories {
maven {
url "https://repo.cyr1en.com/snapshots"
}
}
dependencies {
implementation 'com.cyr1en:javen-core:{version}'
}
Javen is annotation based, therefore, annotations are used to declare the dependencies that are going to be loaded by Javen.
@Lib
annotation could be placed on any class (not functions or fields).
@Lib(group = "group", name = "artifact-id", version = "version")
private class SomeClass {
}
Javen requires a lib directory where it's going to save all of the resolved artifacts.
public static void main(String[] args) {
// Initialize Javen with its lib directory being /libs
Javen javen = new Javen(Paths.get("lib"));
javen.loadDependencies(); // Load all declared deps.
}
Some dependencies requires a specific remote repository (other than Maven central), luckily Javen allows you to add a remote repository. Just make sure to add your remote repositories using .addRepositry()
before loading the jars.
public static void main(String[] args) {
// Initialize Javen with its lib directory being /libs
Javen javen = new Javen(Paths.get("lib"));
javen.addRepository(new Repository("JCenter", "https://jcenter.bintray.com/", "default"));
javen.addRepository("JitPack", "https://Jitpack.io");
javen.loadDependencies(); // Load all declared deps.
}