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 Aug 2, 2019
·
14 revisions
To declare a dependency on a plugin, its manifest should contain the corresponding dependency
element; for example:
<dependencies>
<dependency>
<groupId>myorganization</groupId>
<artifactId>mydependency</artifactId>
<name>MyPluginDependency</name>
<version>0.1.0</version>
</dependency>
</dependencies>
You can retrieve the loaded instance of MyPluginDependency
by using the find
method of your plugin's DependencySystem
(supplied by calling this.getDependencySystem()
on its main class); e.g.:
public final class MyPlugin extends AbstractPlugin {
private MyPluginDependency dependency;
@Override
public void load() {
dependency = this.getDependencySystem().find("myorganization", "mydependency", "MyPluginDependency", "0.1.0");
dependency = this.getDependencySystem().find("myorganization", "mydependency", "MyPluginDependency", "<latest>");
}
@Override
public void unload() {}
}
If a dependency is missing, an UnsatisfiedDependencyException
will be thrown when loading the dependent plugin