Plugin seems to be responsible for a race condition for the atlassian-spring-scanner dependency

Issue #10 resolved
Former user created an issue

We are currently running into some issues while starting Jira. Some plugins failed to start during Jira startup.

Unexpected exception parsing XML document from URL [bundle://79.0:0/META-INF/spring/spring-scanner.xml]; nested exception is java.lang.IllegalStateException: Cannot execute atlassian-spring-scanner-runtime: plugin has an extra copy of atlassian-spring-scanner-annotation classes, perhaps embedded inside the target plugin '<plugin>'; embedding scanner-annotations 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.

There is an open issue at Atlassian regarding this issue: https://jira.atlassian.com/browse/JRASERVER-70511

When analyzing the issue further we searched for references to the 2.0 version of the scanner. The only plugin referencing it within the pom.xml was your plugin:

<?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/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>atlassian-spring-scanner-parent</artifactId>
        <groupId>com.atlassian.plugin</groupId>
        <version>2.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>atlassian-spring-scanner-annotation</artifactId>
    <name>Atlassian Spring Scanner Annotations</name>
    <packaging>atlassian-plugin</packaging>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-amps-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Import-Package>
                            *
                        </Import-Package>
                        <Export-Package>
                            com.atlassian.plugin.spring.scanner,
                            com.atlassian.plugin.spring.scanner.annotation.component,
                            com.atlassian.plugin.spring.scanner.annotation.export,
                            com.atlassian.plugin.spring.scanner.annotation.imports,
                            com.atlassian.plugin.spring.scanner.annotation,
                            <!-- CommonConstants is not meant as API, but I don't want to add another module
                                 just to share this one class between build-time scanners and runtime -->
                            com.atlassian.plugin.spring.scanner.util
                        </Export-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Comments (5)

  1. Roma Bubyakin [Wombats Corp]

    A lot of thanks for the reporting and also for your findings!

    I am already looking into it and will release a fix as soon as possible

    Best Regards, Roman

  2. Roma Bubyakin [Wombats Corp]

    May I ask you, which version of the plugin do you use?

    Because this issue should be fixed in the latest version (v1.1.3)

    Regard, Roman

  3. Log in to comment