2017-12-11 2 views
4

Wir über JIRA Plugin-Entwicklung gearbeitet haben und mit Apache-Commons-Bibliothek für einen bestimmten Zweck Datei-Upload wie folgt:Atlassian Plugin sdk: Maven Abhängigkeit nicht für Apache Commons aufgelöst

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

generiert Plugin fein arbeitet an Entwicklung Atlas Umgebung, aber beim Hochladen des generierten Jar auf JIRA wird der folgende Fehler in den Protokollen angezeigt.

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 

Nachdem wir verschiedene Threads durchlaufen haben, um dieses Problem zu beheben, haben wir Folgendes versucht.


  • Versuchte verwendet verschiedene Versionen von Apache-Gemeinsame 1.3.2 OR 1.3 oder 1.2.x etc ...
  • Statt die Maven verwenden wir die .jar-Datei in den Ordner lib direkt hochgeladen und auch der aktualisierte Abhängigkeitsabschnitt. Keiner der oben genannten funktioniert so weit. Hier

ist die pom.xml Datei:

<?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> 

Wir brauchen Führung für die Fehlerbehebung/Lösung oben erläuterten Problem.

Antwort

0

Dies sieht wie eine Bibliothek von Drittanbietern aus. So müssen Sie Ihren Umfang provided-compile ändern -

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

<scope>compile</scope> Durch die Angabe, sagen Sie das SDK, das die commons-Fileupload-Bibliothek wird bei der Kompilierung und Laufzeit benötigt. Das SDK bündelt die commons-fileUpload-Bibliothek in Ihrem Plugin, und das Plugin-System stellt sie beim Starten des Plugins im Plugin-Classloader zur Verfügung.

Weitere details - https://developer.atlassian.com/docs/getting-started/working-with-the-pom/managing-dependencies

+0

Danke für Ihre obige Antwort. Wir haben versucht, die folgenden Optionen zu verwenden: - Optional - Bereitgestellt - Kompilieren Aber es funktioniert nicht mit einer der folgenden. Auch das gleiche arbeitet am JIRA-Entwicklungsmodus. – strike

+0

Interessant. Gibt es andere Bibliotheken, die Sie verwenden, die möglicherweise eine Abhängigkeit von dieser Bibliothek haben, aber eine andere Version? –

+0

In diesem Moment verwenden wir keinen anderen Drittanbieter, aber wenn wir einen Drittanbieter hinzufügen, gibt es uns denselben Fehler. Letztendlich können wir keine Drittanbieter verwenden, irgendetwas, wofür wir uns zur Fehlersuche interessieren sollten. – strike

Verwandte Themen