当前位置: 首页 > 知识库问答 >
问题:

atlassian插件sdk: maven依赖未解决apache共享

梁丘权
2023-03-14

我们一直在开发JIRA插件,并使用apache commons库进行文件上传,具体如下:

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>

生成的插件在atlas开发环境中运行良好,但在JIRA上上传生成的Jar时,日志中会显示以下错误。

 2017-12-11 09:49:53,841 UpmAsynchronousTaskManager:thread-3 
 ERROR jira.admin 357x1243x1 1ycla6b 14.102.4.74,13.58.31.162 /rest/plugins/1.0/ 
 [c.a.p.osgi.factory.OsgiPlugin] Detected an error (BundleException) enabling the plugin 'com.atlassian.tutorial.myPlugin' :
 Unresolved constraint in bundle com.atlassian.tutorial.myPlugin [237]: Unable to resolve 237.0: missing requirement [237.0] 
 osgi.wiring.package; (osgi.wiring.package=org.apache.commons.fileupload).  
 This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints,
 or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN

在通过各种线程来解决这个问题之后,我们尝试了以下方法。

  • 尝试使用不同版本的Apache-Common 1.3.2或1.3或1.2. x等...
  • 我们没有使用maven,而是直接在lib文件夹中上传了. jar文件,并更新了依赖项部分。到目前为止,以上都不起作用。

这是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>com.atlassian.tutorial</groupId>
    <artifactId>myPlugin</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <organization>
        <name>Atlassian SDK Tutorial</name>
        <url>http://developer.atlassian.com/</url>
    </organization>
    <name>myPlugin</name>
    <description>This is the com.atlassian.tutorial:myPlugin plugin for Atlassian JIRA.</description>
    <packaging>atlassian-plugin</packaging>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
        <!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
        <!--
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</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.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <version>1.2.3</version>
            <scope>provided</scope>
        </dependency>
       <!-- <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity-tools</artifactId>
            <version>1.3</version>
        </dependency>-->
        <!--<dependency>
            <groupId>info.bliki.wiki</groupId>
            <artifactId>bliki-core</artifactId>
            <version>3.0.19</version>
        </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>
        <!-- WIRED TEST RUNNER DEPENDENCIES -->
        <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>
        <!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
        <!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
        <!--
        <dependency>
            <groupId>com.atlassian.jira.tests</groupId>
            <artifactId>jira-testkit-client</artifactId>
            <version>${testkit.version}</version>
            <scope>test</scope>
        </dependency>
        -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</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>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <!--<dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.2</version>
            <scope>provided</scope>
        </dependency>-->
        <dependency>
            <artifactId>commons-fileupload</artifactId>
            <groupId>commons-fileupload</groupId>
            <version>1.3.2</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/commons-fileupload-1.3.2.jar</systemPath>
            <extractDependencies>false</extractDependencies>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>1.3.1</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>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.version}</productDataVersion>
                    <!-- Uncomment to install TestKit backdoor in JIRA. -->
                    <!--
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.tests</groupId>
                            <artifactId>jira-testkit-plugin</artifactId>
                            <version>${testkit.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    -->
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>
                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                       <!-- <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>-->
                        <!-- Add package to export here -->
                        <Export-Package><com class="atlassian tut"></com>orial.myPlugin.api,</Export-Package>
                        <!-- Add package import here -->
                        <Import-Package>org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <fork>true</fork>
                    <executable>C:\Program Files\Java\jdk1.8.0_151\bin\javac</executable>
                </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>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.plugin</groupId>
                            <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                        </dependency>
                    </scannedDependencies>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <jira.version>7.5.0</jira.version>
        <amps.version>6.3.6</amps.version>
        <jdkLevel>1.8</jdkLevel>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.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>
        <template.renderer.version>1.3.1</template.renderer.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

我们需要有关故障排除/解决上述问题的指导。

共有1个答案

甄飞飙
2023-03-14

这看起来像第三方库。因此,您需要将范围从提供更改为编译-

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>

通过指定

更多细节-https://developer.atlassian.com/docs/getting-started/working-with-the-pom/managing-dependencies

 类似资料:
  • TL;DR两个gradle插件使用相同依赖项的不同版本,在调用其中一个插件时会导致编译错误。 > 我有一个使用Gradle4编译的Java项目。十、 该项目依赖于两个插件:gradle-jaxb-plugin和serenity-gradle-plugin。 两个插件共享一个依赖项,guice。 我需要升级一个插件(serenety)。升级会导致调用jaxb插件时发生冲突。 我做了一些调查和谷歌搜索

  • 当尝试为我的gradle项目运行idea插件时,我的一些intellij库与。库本身标记为“未解析的依赖项” 我的gradle项目是一个多模块,我已经将idea插件应用于。 Intellij版本为#IU-134.1007 分级版本为1.11 这三个都有错误

  • 我已经创建了一个构建。war文件的非常简单的Maven项目。Maven Version3.2.3,Java Version1.7.0_67。pom.xml文件就是这个要点。 如果我运行,那么项目构建良好。但是,如果首先下载所有具有和的依赖项,然后运行进行脱机构建,则会出现如下错误。 我从两种方式创建的。m2/repository文件夹不同,使用依赖插件创建的文件夹缺少许多文件,其中大多数与Plex

  • 依赖 AdminLTE 依赖两个主要的框架。下载的软件包中已经包含这两个库,因此你不必手动下载它们。 Bootstrap 4 jQuery 3.3.1+ Popper.js 1.14.7+ 下面列出了所有其他插件 插件 AdminLTE 使用以下插件。相关文档,更新或许可证信息,请访问提供的链接。 你需要手动加载插件的 js/css 文件。 AdminLTE 不会自动加载所有插件,这会造成页面加载

  • 当我尝试运行mvn sonar时:sonar target maven无法运行sonar,以下是mvn输出的相关部分: org.apache.maven.shared.dependency.tree.依赖 似乎出于某种原因,maven没有下载所需的依赖项。 我配置了一个包含jar的本地nexus,但是不管我的设置中是否有激活的配置文件,我都会得到相同的结果。xml与否。 我应该如何配置maven,

  • 谁能告诉我Maven中的依赖项Hamcrest有什么问题吗?这是一个遗憾,但我不能在这里附上截图。 当我试图更新Maven索引时,什么也没有发生。