Confluence自定义宏不会显示在宏浏览器中

时间:2016-03-31 11:24:25

标签: confluence atlassian-plugin-sdk

我正在关注为汇合版本5.9.7编写自定义宏的官方tutorial。我从教程中更改的唯一内容是插件名称和包名称,您可以在我附加的文件中看到它。运行altas-run.bat之后,我可以在Confluence的系统配置页面中找到已成功安装并启用插件的两个模块。但是当我试图在页面中插入这个宏时,我在宏浏览器中找不到它。

然后我按照完全相同的步骤跟随另一个教程writing a plugin with JSON,一切顺利,但是仍然无法在宏浏览器中找到宏。我在这个问题上花了好几个小时,真的厌倦了。

ExampleMacro.java位于包com.example.api下。与教程中编写的代码相同。以下是插件描述文件。通过运行atlas-create-confluence-plugin.bat自动生成pom。除了汇合版本到5.9.7之外没有任何改变。

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>

    <xhtml-macro name="my-confluence-plugin" class="com.example.api.ExampleMacro" key="my-macro">
        <parameters/>
        <category name="navigation" />
    </xhtml-macro>
    <!-- add our i18n resource -->
    <resource type="i18n" name="i18n" location="my-confluence-plugin"/>

    <!-- add our web resources -->
    <web-resource key="my-confluence-plugin-resources" name="my-confluence-plugin Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>

        <resource type="download" name="my-confluence-plugin.css" location="/css/my-confluence-plugin.css"/>
        <resource type="download" name="my-confluence-plugin.js" location="/js/my-confluence-plugin.js"/>
        <resource type="download" name="images/" location="/images"/>
        <context>my-confluence-plugin</context>
    </web-resource>

</atlassian-plugin>

我在干净运行后在atlas-run控制台中发现了一些错误消息,我认为可能会提供一些信息:

[INFO] [talledLocalContainer] 2016-03-31 14:00:29,799 WARN [UpmScheduler:thread-2] [atlassian.upm.pac.PacClientImpl] fetchMpacAppInfo Error when querying application info from MPAC: com.atlassian.marketplace.client.MpacException: java.net.UnknownHostException: marketplace.atlassian.com
[INFO] [talledLocalContainer] 2016-03-31 14:00:32,829 ERROR [AtlassianEvent::CustomizableThreadFactory-1] [atlassian.plugin.module.PrefixDelegatingModuleFactory] createModule Detected an error instantiating the module via Spring. This usually means that you haven't created a <component-import> for the interface you're trying to use. https://developer.atlassian.com/x/TAEr  for more details.
[INFO] [talledLocalContainer] 2016-03-31 14:00:32,830 WARN [AtlassianEvent::CustomizableThreadFactory-1] [impl.macro.metadata.AllMacroMetadataCache] lambda$loadMacroMetadata$1 Failed to make metadata for module 'com.example.my-confluence-plugin:my-macro': Error creating bean with name 'com.example.api.ExampleMacro': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.confluence.xhtml.api.XhtmlContent]: : No qualifying bean of type [com.atlassian.confluence.xhtml.api.XhtmlContent] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.confluence.xhtml.api.XhtmlContent] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
[INFO] [talledLocalContainer] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.example.api.ExampleMacro': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.confluence.xhtml.api.XhtmlContent]: : No qualifying bean of type [com.atlassian.confluence.xhtml.api.XhtmlContent] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.confluence.xhtml.api.XhtmlContent] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

为什么会抱怨没有找到XhtmlContent类型的限定bean?

1 个答案:

答案 0 :(得分:1)

我正在使用Atlassian SDK v6.2.4。

刚刚弄明白了这个问题。似乎这是许多人遇到的常见问题。对于同时使用最新SDK并遵循Confluence当前教程的人,请在Atlassian论坛中查看我的答案:https://answers.atlassian.com/questions/38064029/answers/38064450