Skip to content

⚙ Api to download and load the necessary dependencies into the classloader.

License

Notifications You must be signed in to change notification settings

Cleymax/CLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLibrary logo

Java CI with Maven GitHub stars GitHub Issues GitHub Pull Requests GitHub license


Api to download and load the necessary dependencies into the classloader.

📝 Table of Contents

🧐 About

This library is used to not have too large jar files. The dependencies are downloaded at startup if they have not yet been downloaded otherwise they are downloaded from the central repository of maven or a selected repository.

🏁 Getting Started

These instructions could be use in any type of java project.

First you need to retrieve CLibrary.

Prerequisites

You can download the jar file in the releases. GitHub release (latest by date)

Or get it from github packages: https://github.com/Cleymax/CLibrary/packages

Or get it from my personal repository:

  • Maven
<!-- Add to repositories -->
<repository>
    <id>cleymax-releases</id>
    <url>https://repo.cleymax.fr/repository/maven-releases/</url>
</repository>

<!-- Add to dependencies -->
<dependency>
    <groupId>fr.cleymax</groupId>
    <artifactId>CLibrary</artifactId>
    <version>1.0.3</version>
    <scope>compile</scope>
</dependency>
  • Gradle
// Add to repositories
maven {
    name = 'cleymax-releases'
    url = 'https://repo.cleymax.fr/repository/maven-releases/'
}

// Add to dependencies
compile 'fr.cleymax:CLibrary:1.0.3'

Use

Example, you need Gson in your project. Add the annotation @Dependency on any class to load Gson .

import fr.cleymax.clibrary.CLibrary;
import fr.cleymax.clibrary.Dependency;

@Dependency(groupId = "com.google.code.gson", artifactId = "gson", version = "2.8.6")
public class Main {

  public static void main(String[] args)
  {
    final CLibrary library = new CLibrary(Main.class);  //Initialize a new instance of `CLibrary`.
    library.loads(); //Load all dependencies of the class that is set as a parameter when initializing the `CLibrary' instance.
  }
}

You can load several dependencies in one class.

import fr.cleymax.clibrary.CLibrary;
import fr.cleymax.clibrary.Dependencies;
import fr.cleymax.clibrary.Dependency;

@Dependencies({
  @Dependency(groupId = "com.google.code.gson", artifactId = "gson", version = "2.8.6"),
  @Dependency(groupId = "com.googlecode.json-simple", artifactId = "json-simple", version = "1.1.1")
})
public class Main {

  public static void main(String[] args)
  {
    final CLibrary library = new CLibrary(Main.class);  //Initialize a new instance of `CLibrary`.
    library.loads(); //Load all dependencies of the class that is set as a parameter when initializing the `CLibrary' instance.
  }
}

You can choose where the dependencies are stored and downloaded.

final CLibrary library = new CLibrary(Main.class, new File("dependancies/"));

You can initialize an instance of CLibrary without any parameters. But the method CLibrary#loads() can no longer be used!

final CLibrary library = new CLibrary();

You can choose the repository or you have to download the dependency. Note that if the file cannot be uploaded with the custom repository then it will try to upload to maven's central repository.

@Repository(url = "https://repo.cleymax.fr/repository/maven-releases/")
@Dependency(groupId = "com.google.code.gson", artifactId = "gson", version = "2.8.6")

✍️ Authors

  • @Cleymax - Idea & Initial work Discord: Cleymax#7002

See also the list of contributors who participated in this project.

⛏️ Built Using

🎉 License

CLibrary is licensed under the MIT license.

About

⚙ Api to download and load the necessary dependencies into the classloader.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages