Hi,
I want to create 2 plugins on Confluence: the first is like a "core" and the second, "macro" uses this core.
I created 2 plugins with atlas-create-confluence-plugin command.
Following the snippset, I only kept api/MyPluginComponent interface:
public interface MyPluginComponent
{
String getName();
}
and impl/MyPluginComponentImpl class file in the "core" plugin:
@Component
public class MyPluginComponentImpl implements MyPluginComponent
{
public String getName()
{
return "myComponent";
}
}
In the "macro" part, I create a Macro wich use MyPluginComponent:
public class PluginMacro implements Macro {
private final MyPluginComponent myPluginComponent;
private final XhtmlContent xhtmlContent;
@Autowired
public PluginMacro(@ComponentImport MyPluginComponent myPluginComponent, @ComponentImport XhtmlContent xhtmlContent) {
this.myPluginComponent = myPluginComponent;
this.xhtmlContent = xhtmlContent;
}
@Override
public String execute(Map<String, String> map, String s, ConversionContext conversionContext) {
try {
return xhtmlContent.convertStorageToView(myPluginComponent.getName(), conversionContext);
} catch (XMLStreamException | XhtmlException e) {
e.printStackTrace();
}
return "Error";
}
@Override
public BodyType getBodyType() {
return BodyType.NONE;
}
@Override
public OutputType getOutputType() {
return OutputType.BLOCK;
}
}
The core part compiles, but of course the "macro" part needs the "core" dependencies. I try to add the jar with Maven, but when I upload "core" and "macro" on my Confluence, I take this error :
ERROR [Spring DM Context Creation Timer] [internal.dependencies.startup.DependencyWaiterApplicationContextExecutor] fail Unable to create application context for [com.km.plugin_macro], unsatisfied dependencies: Dependency on [(&(objectClass=com.km.core.api.MyPluginComponent)(objectClass=com.km.core.api.MyPluginComponent))]
In /plugins/servlet/upm/osgi, I can see "macro" imports com.km.core.api..
I don't know if I use the right annotations, or maybe I need to update pom.xml files ?
Thanks for the help,
Richard
Hi Richard,
You need to include a dependency for core plugin in the pom.xml of the macro plugin and create an obr of the macro plugin. Please refer to the below links
Hope this helps.
Thanks,
Santwana
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.