[ERROR] Manifest com.x.jira.plugin:com.x.jira.plugin-y:atlassian-plugin:1.0.0 : The default package '.' is not permitted by the Import-Package syntax

  1. How to fix this error?
  2. Should I place all dependencies to Import-Package? Only packages, used in my code from this libs
    or root packages of dependencies?
  3. If last, how to define root packages, should I manually open jar to see it?
    Because from errors I see that Import-Package does not corresponds to groupId.
  4. Do we have only maven way to build the plugin?
  5. Why plugin requires additional oracle dependencies, when other java
    apps need only jdbc driver?
    Such great JIRA for users, but development of plugins is a hell for me (and other developers, I read).
    I spent several nights without any pogress and there are no practical examples with dependencies- just fictional ‘my-lib*’.

[ERROR] Manifest com.x.jira.plugin:com.x.jira.plugin-y:atlassian-plugin:1.0.0 : The default package ‘.’ is not permitted by the Import-Package syntax

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.x.jira.plugin</groupId>
   <artifactId>com.x.jira.plugin-y</artifactId>
   <version>1.0.0</version>
   <organization>
      <name>x</name>
      <url>https://x.co</url>
   </organization>
   <name>com.x.jira.plugin-y</name>
   <description>This is the com.x.jira.plugin:com.x.jira.plugin-y 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>
      <!--START y DB-->
      <dependency>
         <groupId>com.oracle</groupId>
         <artifactId>ojdbc6</artifactId>
         <version>${ojdbc6.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>com.oracle</groupId>
         <artifactId>oraclepki</artifactId>
         <version>1.0</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>com.oracle</groupId>
         <artifactId>orai18n</artifactId>
         <version>${orai18n.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>com.oracle.ons</groupId>
         <artifactId>com.springsource.oracle.ons</artifactId>
         <version>${com.springsource.oracle.ons.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>c3p0</groupId>
         <artifactId>c3p0</artifactId>
         <version>${c3p0.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>com.sun.jna</groupId>
         <artifactId>jna</artifactId>
         <version>${jna.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>net.java.dev.jna</groupId>
         <artifactId>jna-platform</artifactId>
         <version>${jna-platform.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <version>${cdi-api.version}</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>javax.resource</groupId>
         <artifactId>javax.resource-api</artifactId>
         <version>${javax.resource-api.version}</version>
         <scope>compile</scope>
      </dependency>
      <!--<dependency>-->
      <!--<groupId>org.postgresql</groupId>-->
      <!--<artifactId>postgresql</artifactId>-->
      <!--<version>${postgresql.version}</version>-->
      <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <!--<dependency>-->
      <!--<groupId>com.microsoft.sqlserver</groupId>-->
      <!--<artifactId>mssql-jdbc</artifactId>-->
      <!--<version>${mssql-jdbc.version}</version>-->
      <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <!--<dependency>-->
      <!--<groupId>mysql</groupId>-->
      <!--<artifactId>mysql-connector-java</artifactId>-->
      <!--<version>${mysql-connector-java.version}</version>-->
      <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <!--<dependency>-->
      <!--<groupId>org.apache.commons</groupId>-->
      <!--<artifactId>commons-lang3</artifactId>-->
      <!--<version>${commons-lang3.version}</version>-->
      <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <dependency>
         <groupId>org.projectlombok</groupId>
         <artifactId>lombok</artifactId>
         <version>1.18.4</version>
         <scope>provided</scope>
      </dependency>
      <!--END y DB-->
      <!-- 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.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>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>2.4</version>
         <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.plugins.rest</groupId>
         <artifactId>atlassian-rest-common</artifactId>
         <version>1.0.2</version>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>com.atlassian.sal</groupId>
         <artifactId>sal-api</artifactId>
         <version>2.6.0</version>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.wink</groupId>
         <artifactId>wink-client</artifactId>
         <version>1.1.3-incubating</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-all</artifactId>
         <version>1.8.5</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.x.jira.plugin.y.api,
	                        com.sun.security.auth.module,</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>
      </plugins>
   </build>
   <properties>
      <jira.version>7.12.0</jira.version>
      <amps.version>6.3.21</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>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
      <postgresql.version>42.2.5.jre7</postgresql.version>
      <mssql-jdbc.version>7.0.0.jre8</mssql-jdbc.version>
      <mysql-connector-java.version>8.0.13</mysql-connector-java.version>
      <commons-lang3.version>3.8.1</commons-lang3.version>
      <javax.resource-api.version>1.7.1</javax.resource-api.version>
      <orai18n.version>11.2.0.3</orai18n.version>
      <com.springsource.oracle.ons.version>10.2.0.2</com.springsource.oracle.ons.version>
      <ojdbc6.version>12.1.0.1-atlassian-hosted</ojdbc6.version>
      <c3p0.version>0.9.1.2</c3p0.version>
      <jna.version>3.0.9</jna.version>
      <jna-platform.version>5.2.0</jna-platform.version>
      <cdi-api.version>2.0</cdi-api.version>
   </properties>
</project>

Hi @akharkovskij,

I would love to help you out. I replied on your ticket and let’s see what we can do there and afterwards share it here.

Cheers,
Anne Calantog

1 Like

Hi! @acalantog all other issues solved, thx! Except main:

   ___ FAILED PLUGIN REPORT _____________________
    
    1 plugin failed to load during JIRA startup.
    
    	'com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin' - 'xproduct-admin-ui-plugin'  failed to load.
    		Error creating bean with name 'xPluginComponent': Bean instantiation via constructor failed; nested exception is java.lang.ExceptionInInitializerError
    			null
    				java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver not found by com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin [139]
    					oracle.jdbc.driver.OracleDriver not found by com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin [139]
    
    		It was loaded from D:\com.y.jira.plugin-server.x\target\jira\home\plugins\installed-plugins\xproduct-admin-ui-plugin-1.0.0-SNAPSHOT.jar

How to SIMPLY add ojdbc? Why it is so painful?

<?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.plugins.tutorial</groupId>
    <artifactId>xproduct-admin-ui-plugin</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
    </organization>
    <name>xproduct-admin-ui-plugin</name>
    <description>This is the com.atlassian.plugins.tutorial:xproduct-admin-ui-plugin plugin for Atlassian Refapp.</description>
    <packaging>atlassian-plugin</packaging>
    <dependencies>
	     <dependency>
                            <groupId>com.oracle</groupId>
                            <artifactId>ojdbc6</artifactId>
                            <version>12.1.0.1-atlassian-hosted</version>
            <scope>provided</scope>
                        </dependency>
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>8.0.14</version>
            <scope>provided</scope>
                        </dependency>
	    
       
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</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.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>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <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>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <version>1.0.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.wink</groupId>
            <artifactId>wink-client</artifactId>
            <version>1.1.3-incubating</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.platform</groupId>
                <artifactId>platform</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.platform</groupId>
                <artifactId>third-party</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
	         <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.18.4</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>7.0.0</productVersion>
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>
                    <libArtifacts>
                        <libArtifact>
                            <groupId>com.oracle</groupId>
                            <artifactId>ojdbc6</artifactId>
                            <version>12.1.0.1-atlassian-hosted</version>
                        </libArtifact>
                        <libArtifact>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>8.0.14</version>
                        </libArtifact>
                    </libArtifacts>
                    <!-- 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.atlassian.plugins.tutorial.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>
        </plugins>
    </build>
    <properties>
        <platform.version>3.0.0</platform.version>
        <refapp.version>3.3.6</refapp.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>
        <!-- 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>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

Guys, community, please, help! I think, this is very simple case, but useful and looks like search gives no good solutions.

Hi @arthurdnu,

As per our conversation, this

was solved here . Can you please mark it as solved?

For adding ojdbc dependency - in our conversation before:

I saw this same post you and I think the response you got makes sense. When you do add the driver as dependencies in your plugin, it will result to a huge jar and you could have issue with the licensing, that is if you have a compile scope.

You may ask the Jira admin to add the drivers as defined here as what Jira does. Now if you must really add it in your plugin, see this accepted answer from the community.

Cheers,
Anne Calantog

Hi @acalantog ,

I have the same issue with manifest. How to solve it?
Thanks in advance.