Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Adding licensing support does not work

Florian Marquardt February 4, 2015

I have a JIRA Plugin and want to add licensing support to publish it 'paid via atlassian'.

Therefor I worked through the corresponding tutorial https://developer.atlassian.com/market/add-on-licensing-for-developers. The first steps worked fine. I saw the license information for my plugin at the add-on manager.

Now I tried to handle license-errors in my code and here I am stuck sad

I ran atlas-create-jira-plugin-module and chose option 11 with all parameters set to default.

When the plugin is installed into my JIRA-SDK instance the following error occurs:

[INFO] [talledLocalContainer] org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl] for bean with name 'thirdPartyPluginLicenseStorageManager' defined in URL [bundle://162.0:0/META-INF/spring/atlassian-plugins-components.xml]; nested exception is java.lang.ClassNotFoundException: com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl not found from bundle [...]

I'm not really suprised because due to atlas-create-jira-plugin-module my pom was enriched by the following snippet:

<dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>plugin-license-storage-lib</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>compile</scope>
            <!-- intentionally compile scoped -->
        </dependency>

But I can not find the corresponding jar in the classpath of my plugin. But given the compile scope it should be packaged into the jar, shouldn't it?!

Could you give me some hint where the error is?!?! I suppose it's some kind of version incompatibility. But which combination will work???

To be complete here are the relevant parts of my pom.xml and atlassian-plugin.xml. My SDK is up to date.

<?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>
[...]
    <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>com.atlassian.upm</groupId>
            <artifactId>plugin-license-storage-lib</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>compile</scope>
            <!-- intentionally compile scoped -->
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>plugin-license-storage-plugin</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>licensing-api</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>upm-api</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>provided</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>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <version>2.0.17</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>14.0.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.osgi</groupId>
            <artifactId>spring-osgi-core</artifactId>
            <version>1.1.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.1.1</version>
            <scope>test</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>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.version}</productDataVersion>
                    <useFastdevCli>false</useFastdevCli>
                    <compressResources>false</compressResources>
                    <jvmArgs>-Xmx1024m -XX:MaxPermSize=512m</jvmArgs>
                    <instructions>
                        <Private-Package>com.atlassian.upm.license.storage.lib*</Private-Package>
                        <DynamicImport-Package>com.atlassian.upm.api.license.entity;version="${upm.license.compatibility.version}", com.atlassian.upm.api.license;version="${upm.license.compatibility.version}", com.atlassian.upm.api.util;version="${upm.license.compatibility.version}", com.atlassian.upm.license.storage.plugin;version="${upm.license.compatibility.version}"</DynamicImport-Package>
                    </instructions>
                    <bundledArtifacts>
                        <bundledArtifact>
                            <groupId>com.atlassian.upm</groupId>
                            <artifactId>plugin-license-storage-plugin</artifactId>
                            <version>${upm.license.compatibility.version}</version>
                        </bundledArtifact>
                    </bundledArtifacts>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-amps-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <enableFastdev>false</enableFastdev>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-storage-plugin</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <includeArtifactIds>plugin-license-storage-plugin</includeArtifactIds>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <properties>
        <jira.version>6.3.9</jira.version>
        <amps.version>5.0.4</amps.version>
        <upm.license.compatibility.version>2.3</upm.license.compatibility.version>
    </properties>
</project>
<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
  <plugin-info>
    <description>${project.description}</description>
    <version>${project.version}</version>
    <vendor name="${project.organization.name}" url="${project.organization.url}"/>
    <param name="plugin-icon">images/pluginIcon.png</param>
    <param name="plugin-logo">images/pluginLogo.png</param>
    <param name="atlassian-licensing-enabled">true</param>
  </plugin-info>
  <component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties"/>
  <component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
  <component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider"/>
  <component-import key="renderer" interface="com.atlassian.templaterenderer.velocity.one.six.VelocityTemplateRenderer"/>
  <component-import key="pluginSettingsFactory" interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" filter=""/>
  <component-import key="pluginAccessor" interface="com.atlassian.plugin.PluginAccessor"/>
  <component-import key="pluginController" interface="com.atlassian.plugin.PluginController"/>
  <component-import key="txTemplate" interface="com.atlassian.sal.api.transaction.TransactionTemplate"/>
  <component-import key="pluginLicenseManager" interface="com.atlassian.upm.api.license.PluginLicenseManager"/>

  <component-import key="i18nResolver" interface="com.atlassian.sal.api.message.I18nResolver"/>
  <component key="thirdPartyPluginLicenseStorageManager" class="com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl"/>
  <component key="pluginLicenseStoragePluginInstaller" class="com.atlassian.upm.license.storage.lib.PluginLicenseStoragePluginInstaller"/>
  <component key="atlassianMarketplaceUriFactory" class="com.atlassian.upm.license.storage.lib.AtlassianMarketplaceUriFactoryImpl"/>
  <servlet name="License Servlet" i18n-name-key="license-servlet.name" key="license-servlet" class="....servlet.LicenseServlet">
    <description key="license-servlet.description">The License Servlet Plugin</description>
    <url-pattern>...</url-pattern>
  </servlet>
  <servlet name="License Hello World Servlet" i18n-name-key="license-hello-world-servlet.name" key="license-hello-world-servlet" class="....servlet.LicenseHelloWorldServlet">
    <description key="license-hello-world-servlet.description">The License Hello World Servlet Plugin</description>
    <url-pattern>/.../licensehelloworld</url-pattern>
  </servlet>
</atlassian-plugin>

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Florian Marquardt February 5, 2015

Best solutions are solutions found by oneself.

After searching the needle in the haystack. I finally managed to get my plugin running.

As supposed it was a version incompatibility.

I just changed the SAL dependency:

before:

<dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <version>2.0.17</version>
            <scope>provided</scope>
        </dependency>

after:

<dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <version>2.4.0</version>
            <scope>provided</scope>
        </dependency>

 

However this version fighting is a mess!!!

Dear JIRA-Developers plz make this dependencies more transparent. I was not able to find a compatibility matrix for the UPM-API, I would have saved me hours of desperate guessing.

 

TAGS
AUG Leaders

Atlassian Community Events