Bamboo ProcessService bean 不存在?

Bamboo ProcessService bean does not exist?

https://developer.atlassian.com/bamboodev/bamboo-tasks-api/executing-external-processes-using-processservice 之后,我想使用 ProcessService bean 调用一些命令。 link 中描述的注入不起作用。 我检查了 Bitbucket 上其他几个插件的来源,但每个插件都使用 link.

中描述的概念

我的class:

import com.atlassian.bamboo.process.ProcessService;

public class CheckTask implements TaskType {
    private final ProcessService processService;
    public CheckTask(@NotNull final ProcessService processService) {
        this.processService = processService;
    }

但是 Bamboo 没有找到 ProcessService bean 并且失败并显示以下内容:

(org.springframework.beans.factory.UnsatisfiedDependencyException : Error creating bean with name 'bamboo.tasks.CheckTask': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.bamboo.process.ProcessService]: : No qualifying bean of type [com.atlassian.bamboo.process.ProcessService] 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.bamboo.process.ProcessService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {})

我是不是漏掉了什么? 竹版:5.13.0 AMPS 版本:6.2.6

尝试在您的 atlassian-plugin.xml 下一行添加

<component-import key="processService" 
        interface="com.atlassian.bamboo.process.ProcessService"/>

应该对你有帮助

最后的解决方案很简单,虽然没有官方文档讨论解决方案。希望对您有所帮助。

终于感谢这个 post 我成功了:https://answers.atlassian.com/questions/33141765/testcollationservice-not-injected-into-tasktype-constructor-on-sdk-bamboo

import com.atlassian.bamboo.process.ProcessService;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;

@Scanned
public class CheckTask implements TaskType {

    @ComponentImport
    private final ProcessService processService;

    public CheckTask(@NotNull final ProcessService processService) {
        this.processService = processService;
    }

项目的其余部分基本上是默认的,由 atlas-create-bamboo-plugin 生成。