2

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

然后我按照另一个教程以完全相同的步骤编写了一个带有 JSON 的插件,一切都和上一个一样好,但仍然无法在宏浏览器中找到宏。我在这个问题上花了几个小时,真的受够了。

ExampleMacro.java是在包装下面com.example.api。与教程中编写的代码相同。下面是插件描述文件。pom 是通过运行 atlas-create-confluence-plugin.bat 自动生成的。除了合流版本到 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?

4

1 回答 1

1

我正在使用 Atlassian SDK v6.2.4。

才发现问题。似乎这是许多人遇到的普遍问题。对于同时使用最新 SDK 并遵循 Confluence 当前教程的人,请在此处的 Atlassian 论坛中查看我的答案:https ://answers.atlassian.com/questions/38064029/answers/38064450

于 2016-03-31T14:12:02.913 回答