Maven 无法启动插件:无法解析167.0:缺少要求[167.0]osgi.willing.package;(osgi.willing.package=com.atlassian.inject)

Maven 无法启动插件:无法解析167.0:缺少要求[167.0]osgi.willing.package;(osgi.willing.package=com.atlassian.inject),maven,jira,jira-plugin,atlassian-plugin-sdk,Maven,Jira,Jira Plugin,Atlassian Plugin Sdk,我正在使用最新版本的atlassian SDK为JIRA开发一个插件。我已经编写了大部分代码,并在项目的pom.xml文件中添加了一些所需的依赖项(见下文) 不幸的是,在运行atlas run启动我的本地JIRA环境时,由于以下错误,它无法加载我的插件: 'com.COMPANY.COMPANY-worklog-plugin' - 'COMPANY-worklog-plugin' failed to load. [INFO] [talledLocalContainer] Cannot

我正在使用最新版本的atlassian SDK为JIRA开发一个插件。我已经编写了大部分代码,并在项目的pom.xml文件中添加了一些所需的依赖项(见下文)

不幸的是,在运行atlas run启动我的本地JIRA环境时,由于以下错误,它无法加载我的插件:

'com.COMPANY.COMPANY-worklog-plugin' - 'COMPANY-worklog-plugin'  failed to load.
    [INFO] [talledLocalContainer]  Cannot start plugin: com.COMPANY.COMPANY-worklog-plugin
    [INFO] [talledLocalContainer] Unresolved constraint in bundle com.COMPANY.COMPANY-plugin [167]: Unable to resolve 167.0: missing requirement [167.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.inject)
    [INFO] [talledLocalContainer]
    [INFO] [talledLocalContainer]It was loaded from C:\Project\COMPANY-worklog-plugin\target\jira\home\plugins\installed-plugins\COMPANY-worklog-plugin-1.0.0-SNAPSHOT.jar
我已经被同样的错误困扰了好几天了,包括以下内容:(我通过在POM中添加依赖项成功地修复了这些错误):

我试过以下几件事:

  • 使用Atlassian框架重新生成我的插件,直到我重新添加依赖项
  • 删除并重新添加依赖项以查看错误所在。无法确定是否存在错误的依赖项
  • 更改外部依赖项的范围(提供->编译并返回,必要时进行测试。)
  • 在运行atlas run命令之前,几乎每次都要使用atlas mvn clean
  • 在jira中激活我的插件(超时错误)
  • 在发布之前研究了这个问题。我特别迷路,因为它似乎是一个库存的Atlassian软件包导致了这个问题
  • 我的POM如下所示:

    <?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.maxxton</groupId>
      <artifactId>maxxton-worklog-plugin</artifactId>
      <version>1.0.0-SNAPSHOT</version>
    
      <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
      </organization>
    
      <name>maxxton-worklog-plugin</name>
      <description>This is the com.maxxton:maxxton-worklog-plugin plugin for Atlassian JIRA.</description>
      <packaging>atlassian-plugin</packaging>
    
      <dependencies>
        <dependency>
          <groupId>com.atlassian.jira</groupId>
          <artifactId>jira-api</artifactId>
          <version>${jira.version}</version>
        </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>-->
            <!--&lt;!&ndash;<scope>provided</scope>&ndash;&gt;-->
            <!--<scope>compile</scope>-->
        <!--</dependency>-->
    
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
          <version>2.4</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>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.17</version>
          <scope>compile</scope>
        </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>
        <dependency>
          <groupId>org.beanshell</groupId>
          <artifactId>bsh</artifactId>
          <version>2.0b4</version>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
          <version>4.3.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpasyncclient</artifactId>
          <version>4.0.2</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpmime</artifactId>
          <version>4.3.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.json</groupId>
          <artifactId>json</artifactId>
          <version>20140107</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>com.mashape.unirest</groupId>
          <artifactId>unirest-java</artifactId>
          <version>1.4.9</version>
          <scope>compile</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>
          <scope>compile</scope>
        </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>
        -->   </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.maxxton.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>
            <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>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
        </plugins>   </build>
    
      <properties>
        <jira.version>7.2.4</jira.version>
        <amps.version>6.2.6</amps.version>
        <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>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>   </properties>
    
    </project>
    
    
    4.0.0
    com.maxxton
    maxxton工作日志插件
    1.0.0-SNAPSHOT
    样板公司
    http://www.example.com/
    maxxton工作日志插件
    这是Atlassian JIRA的com.maxxton:maxxton工作日志插件。
    大西洋插件
    com.atlassian.jira
    吉拉api
    ${jira.version}
    朱尼特
    朱尼特
    4.11
    测试
    公地io
    公地io
    2.4
    测试
    com.atlassian.plugin
    atlassian spring扫描仪注释
    ${atlassian.spring.scanner.version}
    编译
    log4j
    log4j
    1.2.17
    编译
    com.atlassian.plugin
    atlassian spring scanner运行时
    ${atlassian.spring.scanner.version}
    运行时
    javax.inject
    javax.inject
    1.
    假如
    org.beanshell
    bsh
    2.0b4
    org.apache.httpcomponents
    httpclient
    4.3.6
    编译
    org.apache.httpcomponents
    httpasyncclient
    4.0.2
    编译
    org.apache.httpcomponents
    httpime
    4.3.6
    编译
    org.json
    json
    20140107
    编译
    com.mashape.unirest
    unirest java
    1.4.9
    编译
    com.atlassian.plugins
    atlassian插件osgi testrunner
    ${plugin.testrunner.version}
    测试
    javax.ws.rs
    jsr311 api
    1.1.1
    假如
    com.google.code.gson
    格森
    2.2.2-atlassian-1
    编译
    com.atlassian.maven.plugins
    maven jira插件
    ${amps.version}
    真的
    ${jira.version}
    ${jira.version}
    真的
    假的
    ${atlassian.plugin.key}
    com.maxxton.api,
    org.springframework.osgi.*;分辨率:=“可选”,
    org.eclipse.gemini.blueprint.*;分辨率:=“可选”,
    *
    *
    com.atlassian.plugin
    atlassian spring scanner maven插件
    ${atlassian.spring.scanner.version}
    大西洋弹簧扫描仪
    进程类
    com.atlassian.plugin
    atlassian弹簧扫描仪外部震击器
    假的
    org.apache.maven.plugins
    maven编译器插件
    1.8
    1.8
    7.2.4
    6.2.6
    1.2.3
    1.2.13
    ${project.groupId}.${project.artifactId}
    6.3.11
    1.7
    1.7
    

    谢谢。

    看起来我找到了修复它的方法,尽管我不确定它是否是一个好的修复方法。它与进口某些包装有关;我不确定它背后的逻辑,但它似乎已经消除了任何和所有捆绑包错误,导致我的插件在启动本地环境时能够完美加载

    对于那些好奇的人,我改变了我的想法:

    <Import-Package>
              org.springframework.osgi.*;resolution:="optional",
              org.eclipse.gemini.blueprint.*;resolution:="optional",
              *
    </Import-Package>
    
    
    org.springframework.osgi.*;分辨率:=“可选”,
    org.eclipse.gemini.blueprint.*;分辨率:=“可选”,
    *
    

    
    org.springframework.osgi.*;分辨率:=“可选”,
    org.eclipse.gemini.blueprint.*;分辨率:=“可选”,
    *;version=“0”;分辨率:=可选
    
    你有问过我吗?我想有人更可能在那里帮助你。我也会试着在那里问你,但从我所看到的,那里有很多类似的问题仍然没有答案。
    <Import-Package>
              org.springframework.osgi.*;resolution:="optional",
              org.eclipse.gemini.blueprint.*;resolution:="optional",
              *
    </Import-Package>
    
    <Import-Package>
              org.springframework.osgi.*;resolution:="optional",
              org.eclipse.gemini.blueprint.*;resolution:="optional",
              *;version="0";resolution:=optional 
    </Import-Package>