Atlassian-scanner 2 not available on runners?


when i want to run my plugin with a custom TaskType on a remote runner i get the following message when the plugin is being loaded:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace []

I’ve searched a bit for that and found out, that spring-annotations seem not to be supported for remote runners. But what should i do instead? I thought atlassian-scanner is mandatory when developing a plugin?
I’m using Bamboo version 7.0.3 and atlassian-spring-scanner 2.2.0.

Thanks for any helpful hint!

Keep in mind that agents are running in a different context than Bamboo Server. They are lightweight instances designed only for a specific purpose (running tasks). This also means that they are not running Spring / OSGi. Changes are, you are probably not going to be able to do much dependency injection anyway.

What are you trying to accomplish?

1 Like

Nothing too special. In the task type i’m creating TestResults by reading and parsing a test report file. The task type uses one single @ComponentImport to access the TestCollationService and apply my CustomTestReportCollector as described here (and added the annotation):

Btw. when i remove the annotation i get No qualifying bean of type [] found for dependency when i try to run it locally and the same error as above in the remote runner…

Hmm, ok, so looking at the Bamboo sources, it seems that they are using Spring scanner in some of the built-in Tasks. For instance, if you look at the sources of JUnitResultParserTask, it reads:

    public JUnitResultParserTask(@ComponentImport TestCollationService testCollationService) {

With the following imports:

import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import javax.inject.Inject;

So it seems that this should be possible. I would really encourage you to look at the Bamboo sources to see if you can learn from how they have been doing it. Specifically, search for implements TaskType and you will be able to check out the constructors on all built-in tasks.

1 Like