-
Notifications
You must be signed in to change notification settings - Fork 2
Bintray JCenter
Dot-Rar edited this page Nov 10, 2018
·
2 revisions
JCenter is a repository on Bintray, so refer to this page for information on JCenter artifacts.
DependencyManager provides a BintrayDependency
class with the following constructor:
BintrayDependency(Plugin owner, String repositoryOwner, String repositoryName, String group, String artifact, String version)
As an example, we'll be loading my friend's owo.java artifact from Bintray.
We'll need to create a new instance of BintrayDependency
and parse in the following parameters:
-
owner
: Instance of your Plugin -
repositoryOwner
:bramhaag
(The name of the Bintray user) -
repositoryName
:maven
(The name of the user's repository). My friend has called his repositorymaven
, which is kind of confusing. -
group
:me.bramhaag
(Group ID of the binary) -
artifact
:owo-java
(Artifact ID of the binary) -
version
:2.2
(Version of the artifact)
Here's the result:
Dependency dependency = new BintrayDependency(this, "bramhaag", "maven", "me.bramhaag", "owo-java", "2.2");
If you're using an artifact from JCenter, however, you only need to provide the owner
, group
, artifact
and version
parameters.
As an example, we'll load the HikariCP artifact from JCenter:
Dependency dependency = new JCenterDependency(this, "com.zaxxer", "HikariCP", "3.2.0");
After we have created our Dependency instance, we can load it like normal by using Dependency#load
:
dependency.load(() -> { // On complete
System.out.println("Artifact has been loaded");
}, (ex) -> { // On error
ex.printStackTrace();
});
Or as a one-liner:
dependency.load(this::start, Throwable::printStackTrace);