This repository has been archived by the owner on Apr 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
PluginDependencies
Foskel edited this page May 21, 2018
·
14 revisions
To declare a dependency, you must add it to the manifest file of a plugin
<dependencies>
<dependency>
<groupId>myorganization</groupId>
<artifactId>mydependency</artifactId>
<name>MyPluginDependency</name>
<version>0.1.0</version>
</dependency>
</dependencies>
If you want to retrieve the main class' instance of a dependency, you can do it from your main class. For example, if you want to get MyPluginDependency
:
public final class MyPlugin extends AbstractPlugin {
private MyPluginDependency dependency;
@Override
public void load() {
dependency = this.getDependencySystem().find("myorganization", "mydependency", "MyPluginDependency", "0.1.0");
// You can also leave version null or use "<latest>" for retrieving the most up-to-date MyPluginDependency
dependency = this.getDependencySystem().find("myorganization", "mydependency", "MyPluginDependency", "<latest>");
dependency = this.getDependencySystem().find("myorganization", "mydependency", "MyPluginDependency", null);
}
@Override
public void unload() {
}
}
If a dependency is missing, an UnsatisfiedDependencyException
will be thrown when the plugins are loaded.