首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >插件maven编译错误

插件maven编译错误
EN

Stack Overflow用户
提问于 2019-12-04 14:45:18
回答 2查看 538关注 0票数 1

我有与BitBucket版本5.2.2一起工作的插件,我想更新它以支持BitBucket版本6.8.0。在按下面的方式更新我的pom.xml之后,当我尝试运行mvn compile时,我会遇到依赖关系的错误:

pom.xml:

代码语言:javascript
复制
<?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>

编译时错误:

代码语言:javascript
复制
[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

我不确定所提到的bitbucket版本应该对应什么版本的、amps、和,这可能是导致错误的原因之一。

EN

回答 2

Stack Overflow用户

发布于 2019-12-10 23:24:58

尝试下面的版本设置,我没有尝试它们,但我遇到了一个在bitbucket 6.x上工作的开源存储库

代码语言:javascript
复制
<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>

回购

票数 0
EN

Stack Overflow用户

发布于 2019-12-16 07:19:04

您使用的是不兼容的amps版本。使用BB6.8.0,您需要amps 8.0.16 https://marketplace.atlassian.com/apps/1210993/atlassian-plugin-sdk-tgz/version-history

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59178643

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档