1

I have plugin that worked with BitBucket version 5.2.2 and I want to update it to support BitBucket version 6.8.0. After updating my pom.xml as below when I try to run mvn compile I face error for dependency:

pom.xml:

<?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>*******custom-plugin-groupId*******</groupId>
        <artifactId>*******custom-plugin-artifactId*******</artifactId>
        <version>2.0.0</version>

        <parent>
            <groupId>*******custom-parent-plugin-groupId*******</groupId>
            <artifactId>parent</artifactId>
            <version>0.7</version>
        </parent>

        <name>*******Plugin Name*******</name>
        <description>*******Plugin Description*******</description>
        <packaging>atlassian-plugin</packaging>

        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.bitbucket.server</groupId>
                    <artifactId>bitbucket-parent</artifactId>
                    <version>${bitbucket.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>

        <dependencies>
            <dependency>
                <groupId>com.atlassian.sal</groupId>
                <artifactId>sal-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.bitbucket.server</groupId>
                <artifactId>bitbucket-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.bitbucket.server</groupId>
                <artifactId>bitbucket-spi</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.bitbucket.server</groupId>
                <artifactId>bitbucket-page-objects</artifactId>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.1</version>
                <classifier>tests</classifier>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-annotation</artifactId>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-runtime</artifactId>
                <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>junit</groupId>
                <artifactId>junit</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>1.5.7.RELEASE</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>2.12.0</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>
            </dependency>
            <dependency>
                <groupId>com.atlassian.templaterenderer</groupId>
                <artifactId>atlassian-template-renderer-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>4.2.5.RELEASE</version>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>bitbucket-maven-plugin</artifactId>
                    <version>${amps.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <extractDependencies>false</extractDependencies>
                        <products>
                            <product>
                                <id>bitbucket</id>
                                <instanceId>bitbucket</instanceId>
                                <version>${bitbucket.version}</version>
                                <dataVersion>${bitbucket.data.version}</dataVersion>
                            </product>
                        </products>
                        <instructions>
                            <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

                            <Import-Package>
                                org.springframework.osgi.*;resolution:="optional",
                                org.eclipse.gemini.blueprint.*;resolution:="optional",
                                *
                            </Import-Package>

                            <Spring-Context>*</Spring-Context>
                        </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>
                        <includeExclude>-com.atlassian.plugin.spring.scanner.annotation.*</includeExclude>

                        <scannedDependencies>
                            <dependency>
                                <groupId>com.atlassian.plugin</groupId>
                                <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                            </dependency>
                        </scannedDependencies>
                        <verbose>false</verbose>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>
                                                com.atlassian.maven.plugins
                                            </groupId>
                                            <artifactId>
                                                bitbucket-maven-plugin
                                            </artifactId>
                                            <versionRange>
                                                [6.3.21,)
                                            </versionRange>
                                            <goals>
                                                <goal>
                                                    generate-rest-docs
                                                </goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore></ignore>
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
       <properties>
            <bitbucket.version>6.8.0</bitbucket.version>
            <bitbucket.data.version>6.8.0</bitbucket.data.version>
            <amps.version>6.2.11</amps.version>
            <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
            <atlassian.spring.scanner.version>1.2.13 
            </atlassian.spring.scanner.version>
            <atlassian.plugin.key>${project.groupId}.${project.artifactId} 
            </atlassian.plugin.key>
        </properties>
    </project>

Error on compile:

[INFO] --- bitbucket-maven-plugin:6.2.11:compress-resources (default-compress-resources) @ custom-plugin ---
    [WARNING] Error injecting: com.atlassian.maven.plugins.updater.MarketplaceSdkResource
java.lang.NoClassDefFoundError: Lorg/codehaus/jackson/map/ObjectMapper;
    at java.lang.Class.getDeclaredFields0 (Native Method)
    at java.lang.Class.privateGetDeclaredFields (Class.java:2583)
    at java.lang.Class.getDeclaredFields (Class.java:1916)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper

I am not sure what should be corresponding version of amps and bitbucket-maven-plugin for mentioned bitbucket version which can possibly be one of reasons for the error.

S R
  • 674
  • 2
  • 18
  • 45

2 Answers2

0

Try the following version settings, I didn't try them but I came across an open source repositry that works on bitbucket 6.x

<properties>
    <bitbucket.version>6.0.0</bitbucket.version>
    <bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
    <plugins.rest.version>3.0.8</plugins.rest.version>
    <plugins.webresource.version>3.4.3</plugins.webresource.version>
    <amps.version>8.0.0</amps.version>
    <plugin.testrunner.version>1.1.1</plugin.testrunner.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

The repo

AbdulKarim
  • 605
  • 5
  • 18
0

You're using incompatible amps version. With BB 6.8.0 you need amps 8.0.16 https://marketplace.atlassian.com/apps/1210993/atlassian-plugin-sdk-tgz/version-history

Yuri G.
  • 4,323
  • 1
  • 17
  • 32