Hi @KDanial,
Thank your for your helpful tip!
It took me some time since I did not get the Spring Scanner running with Confluence 9. Now I switched to Spring Java Config (I am more comfortable with) and the following allows to deploy the app:
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
com.atlassian.confluence.plugins.createcontent.api.*;resolution:="optional",
*
</Import-Package>
There was still an issue when I created a new page with this blueprint:
java.lang.RuntimeException occurred dispatching com.atlassian.confluence.plugins.createcontent.events.BlueprintPageCreateEvent to [com.example.plugins.tutorial.confluence.simplebp.MyBlueprintListener]
java.lang.ClassNotFoundException: com.atlassian.confluence.plugins.createcontent.api.blueprint.ContentBlueprint
With the (snipped) stack trace:
[INFO] [talledLocalContainer] 17:38:21,256 ERROR [http-nio-1990-exec-7 url: /confluence/rest/api/content/blueprint/instance/1081351; user: admin] [confluence.event.ConfluenceListenerInvoker] log java.lang.RuntimeException occurred dispatching com.atlassian.confluence.plugins.createcontent.events.BlueprintPageCreateEvent to [com.example.plugins.tutorial.confluence.simplebp.MyBlueprintListener]
[INFO] [talledLocalContainer] -- url: /confluence/rest/api/content/blueprint/instance/1081351 | userName: admin | referer: http://localhost:1990/confluence/pages/resumedraft.action?draftId=1081351&draftShareId=274211e6-921e-49f2-b8d0-bcbe355e244d& | traceId: b380fce617441f59
[INFO] [talledLocalContainer] java.lang.RuntimeException: com/atlassian/confluence/plugins/createcontent/api/blueprint/ContentBlueprint. Listener: com.example.plugins.tutorial.confluence.simplebp.MyBlueprintListener event: com.atlassian.confluence.plugins.createcontent.events.BlueprintPageCreateEvent
<snip>...</snip>
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
[INFO] [talledLocalContainer] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
[INFO] [talledLocalContainer] at java.base/java.lang.Thread.run(Thread.java:840)
[INFO] [talledLocalContainer] Caused by: java.lang.NoClassDefFoundError: com/atlassian/confluence/plugins/createcontent/api/blueprint/ContentBlueprint
[INFO] [talledLocalContainer] at com.example.plugins.tutorial.confluence.simplebp.MyBlueprintListener.onBlueprintCreateEvent(MyBlueprintListener.java:28)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[INFO] [talledLocalContainer] at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:42)
[INFO] [talledLocalContainer] ... 469 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: com.atlassian.confluence.plugins.createcontent.api.blueprint.ContentBlueprint not found by com.example.plugins.tutorial.confluence.simplebp [309]
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
[INFO] [talledLocalContainer] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[INFO] [talledLocalContainer] ... 475 more
Then I added a compile scope dependency to the POM:
<dependency>
<groupId>com.atlassian.confluence.plugins</groupId>
<artifactId>confluence-create-content-api</artifactId>
</dependency>
And the “hello world blueprint project” works!
Thank you again!
Edit: Just in case someone would like to have a look at the code: https://bitbucket.org/smartics/confluence-eventlistener-blueprint/