我正在使用Atlassian-SDK开发一个Bamboo插件。此插件会在Bamboo Jobs页面中添加一个新的标签,该页面将在同一标签中显示HTML报告(存在于工件中)。
我的Atlassian-plugin.xml看起来像
<xwork key="viewRobotReport" name="View Robot Report">
<package name="RobotPlugin" extends="buildResultView">
<action name="viewRobotReport" class="robot.RobotReport">
<result name="success" type="freemarker">viewRobotReport.ftl</result>
</action>
</package>
</xwork>
<web-item key="RobotJob-${planKey}-${buildNumber}" name="RobotReport" section="results.subMenu/results" weight="80">
<label key="Robot Report"/>
<link linkId="RobotBuild-${planKey}-${buildNumber}">/build/result/viewRobotReport.action?buildKey=${planKey}&buildNumber=${buildNumber}
</link>
<condition class="robot.RobotReportViewCondition"/>
</web-item>
我正在从ViewBuildResults扩展我的类RobotReport,以便我可以获取工件详细信息。
点击标签后,我收到错误
Apologies, this page could not be properly decorated (data is missing)
页面的URL是 172.xx.x.x0:6990 /竹/建造/结果/ viewRobotReport.action buildKey = TPRO1-TPLAN1-JOB1&安培; buildNumber = 1
从日志中我可以看到以下错误
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,724 INFO [http-nio-6990-exec-12] [AccessLogFilter] admin GET http://172.20.1.30:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1&_=1525264904397 177957kb
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,725 ERROR [http-nio-6990-exec-12] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/build/result] and action name [viewRobotReport] associated with context path [/bamboo].
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,788 INFO [http-nio-6990-exec-9] [AccessLogFilter] admin GET http://172.20.1.30:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1 76808kb
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,789 ERROR [http-nio-6990-exec-9] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/build/result] and action name [viewRobotReport] associated with context path [/bamboo].
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,819 ERROR [http-nio-6990-exec-9] [runtime] Error executing FreeMarker template
[INFO] [talledLocalContainer] FreeMarker template error:
[INFO] [talledLocalContainer] The following has evaluated to null or missing:
[INFO] [talledLocalContainer] ==> navigationContext [in template "decorators/resultDecorator.ftl" at line 17, column 18]
[INFO] [talledLocalContainer]
我了解BambooStruts无法在 / bamboo 中的命名空间 / build / result 中找到操作。< / p>
我的freemarker模板仅包含此位。
<html>
<head>
<meta name="decorator" content="result"/>
</head>
<body>
</body>
</html>
在bamboo&#39 / s / build / result命名空间中添加动作(viewRobotReport)的正确方法是什么?
Bamboo Developer论坛没有实现这一目标的指南。 在某个地方,它提到&#34;二传手注射&#34;但不确定那是什么。
任何微小的暗示都会受到高度赞赏。提前谢谢。
答案 0 :(得分:0)
当我查看 atlas-run 的所有日志时,我发现了问题所在。 我可以在日志中的下面..
[INFO] [talledLocalContainer] 2018-05-03 13:30:07,737 ERROR [localhost-startStop-1] [BambooPluginUtils] A problem has occurred when instantiating action class [robot.RobotReport], skipping action [viewRobotReport]
[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'robot.RobotReport': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.atlassian.bamboo.storage.StorageLocationService com.atlassian.bamboo.build.ViewBuildResults.storageLocationService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.bamboo.storage.StorageLocationService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
我通过以下操作在代码中修复了它。
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
@Scanned
public class RobotReport extends ViewBuildResults {
public RobotReport(@ComponentImport StorageLocationService storageLocationService){
有用的链接