Incorrect use of atlassian-spring-scanner-runtime

So I'm learning to make Service Desk Addons via this tutorial, and I'm getting the following error once I get to step 4.3:

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://261.0:0/META-INF/spring/spring.xml]; nested exception is java.lang.IllegalStateException: Incorrect use of atlassian-spring-scanner-runtime: atlassian-spring-scanner-runtime classes are embedded inside the target plugin 'com.atlassian.plugins.tutorial.servicedesk.servicedesk-automation-extension'; embedding scanner-runtime is not supported since scanner version 2.0. Use 'mvn dependency:tree' and ensure the atlassian-spring-scanner-annotation dependency in your plugin has <scope>provided</scope>, not 'runtime' or 'compile', and you have NO dependency on atlassian-spring-scanner-runtime.

I've gone back and restarted this tutorial from the start a few times and continue to get this error. I'm not sure what I need to remove from my pom.xml file to get this working. My pom file is in the comments due to size restriction in the description.

 Thank you in advance for any help you can provide. 

PS: I've tried atlas-clean, no dice.

3 answers

1 accepted

0 votes
Accepted answer
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.atlassian.plugins.tutorial.servicedesk</groupId>
<artifactId>servicedesk-automation-extension</artifactId>
<version>1.0.0-SNAPSHOT</version>

<organization>
<name>Org</name>
<url>http://www.organization.com</url>
</organization>

<name>servicedesk-automation-extension</name>
<description>Adds a new when, if and then rule component to JIRA Service Desk's automation feature.</description>
<packaging>atlassian-plugin</packaging>

<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>

<!-- User Added Dependency -->
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.servicedesk.plugins.automation</groupId>
<artifactId>servicedesk-automation-api</artifactId>
<version>${servicedesk.automation.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.servicedesk.plugins.automation</groupId>
<artifactId>servicedesk-automation-spi</artifactId>
<version>${servicedesk.automation.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.pocketknife</groupId>
<artifactId>atlassian-pocketknife-api-commons-jira</artifactId>
<version>${pocketknife.api.commons.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<products>
<product>
<id>jira</id>
<instanceId>jira</instanceId>
<version>${jira.version}</version>
<applications>
<application>
<applicationKey>jira-software</applicationKey>
<version>${jira.software.application.version}</version>
</application>
<application>
<applicationKey>jira-servicedesk</applicationKey>
<version>${jira.servicedesk.application.version}</version>
</application>
</applications>
</product>
</products>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<instructions>
<Atlassian-Plugin-Key>
com.atlassian.plugins.tutorial.servicedesk.servicedesk-automation-extension
</Atlassian-Plugin-Key>
<Bundle-SymbolicName>
com.atlassian.plugins.tutorial.servicedesk.servicedesk-automation-extension
</Bundle-SymbolicName>
<Spring-Context>*</Spring-Context>
<Export-Package>
com.atlassian.plugins.tutorial.servicedesk
</Export-Package>
<Import-Package>
com.atlassian.servicedesk.plugins.automation.api.*,
com.atlassian.servicedesk.plugins.automation.spi.*,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<jira.version>7.5.0</jira.version>
<amps.version>6.3.6</amps.version>


<!-- User added properties -->
<atlassian.spring.scanner.version>2.0.1</atlassian.spring.scanner.version>
<servicedesk.automation.version>2.2.7</servicedesk.automation.version>
<springframework.version>4.1.7.RELEASE</springframework.version>
<pocketknife.api.commons.version>0.21.1</pocketknife.api.commons.version>
<jira.software.application.version>7.5.0</jira.software.application.version>
<jira.servicedesk.application.version>3.6.0</jira.servicedesk.application.version>


<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>

Found I just needed to run it in a different environment and it worked. 

HI , can you please provide me the exact pom file that you are using after updating scanner version to 2.0 and the plugin-context file .After making changes iam still getting same error that you have mentioned .

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,653 views 18 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you