Skip to content
Pierre T. edited this page Jan 13, 2015 · 1 revision

It is possible to declare dependencies between plugins. This can be useful when you need a plugin initialized or started before another. For instance, if a plugin needs to access the application configuration, you may want it to start after a "ConfigurationPlugin".

The plugin interface provides two ways to declare dependencies. Given two plugins "A" and "B", "B" dependent on "A". The dependency declaration could done in "A" or in "B".

Dependent of

Use the following method to declare the plugins which are dependent of a plugin "A".

@Override
public Collection<Class<? extends Plugin>> dependentPlugins() {
    Collection<Class<? extends Plugin>> plugins = new ArrayList<Class<? extends Plugin>>();
    plugins.add(B.class);
    ...
    return plugins;
}

Required by

Use the following method to declare the plugin which are required by a plugin "B".

@Override
public Collection<Class<? extends Plugin>> requiredPlugins() {
    Collection<Class<? extends Plugin>> plugins = new ArrayList<Class<? extends Plugin>>();
    plugins.add(A.class);
    ...
    return plugins;
}

Content

Clone this wiki locally