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