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

https://github.com/way-zer/librarymanager

A library helps you manage jvm runtime dependencies
https://github.com/way-zer/librarymanager

dependency-manager java kotlin runtime

Last synced: 2 months ago
JSON representation

A library helps you manage jvm runtime dependencies

Awesome Lists containing this project

README

          

[![](https://jitpack.io/v/way-zer/LibraryManager.svg)](https://jitpack.io/#way-zer/LibraryManager)

**A library helps you manage jvm runtime dependencies** (Such as Kotlin)
## Features
* Finished in pure java (no other dependency)
* Download from maven Repository
* Add dependencies into Classpath
* Get a classloader with dependencies you need
## Env
MAVEN_REPOSITORY :replace the default repository (default: the first repository added)
## Example
#### Usage
```java
import cf.wayzer.libraryManager.*;
class Example{
void load(){
LibraryManager libraryManager=new LibraryManager();
//select 1 from 3 ways
libraryManager.addMavenCentral();
libraryManager.addJCenter();
libraryManager.addRepository("the name you want","the_url");
//select 1 from 3 ways
libraryManager.require(Dependency.KOTLIN_RUNTIME);
libraryManager.require(Dependency("org.jetbrains.kotlin","kotlin-stdlib","1.3.41"));
libraryManager.require(Dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.41","the name you add before"));

try {
//select 1 from 2 ways
libraryManager.loadToClasspath();
libraryManager.getClassloader(getClass().getClassLoader()).loadClass("kotlin.Lazy");
} catch (LibraryLoadException e) {
e.printStackTrace();
}
}
}
```
#### For kotlin main
```kotlin
package example

import cf.wayzer.libraryManager.LibraryManager

//You can't use kotlin Function or Type before loadKotlinStd()
//val v = listOf(123)
fun main() {
LibraryManager.loadKotlinStd()
// Now can use kotlin
listOf(123)
}
```
## Licence
* Keep the name of package.
* If you think it is good, leave a link to this page.
## Contribution
Issues and Pull requests for better library are always welcome!