Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Bundle XXX is importing package(s) [YYY, ZZZ] in start level 20 but no bundle is exporting these for that start level.

Avatar

Level 3

Hi,

 

I am trying to make available the OSGi Service of one Maven project inside another Maven project's Servlet locally, by adding the dependency of the imported project into the importing project per below:

 

 

 

    pom.xml 
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>com.exporter.aem</groupId>
                    <artifactId>exporter-pages.core</artifactId>
                    <version>2.9.0</version>
                    <scope>provided</scope>
                </dependency>
                // other dependencies...
            </dependencies>
        </dependencyManagement>

    core/pom.xml 
        <dependencies>
            <dependency>
                <groupId>com.exporter.aem</groupId>
                <artifactId>exporter-pages.core</artifactId>
            </dependency>
            // other dependencies...
        </dependencies>

 

 

 

The imported project is already installed/deployed, and my Servlet code was able to import the package `com.importer.aem.core.services.MyOSGiService` fine. But when I try to deploy using `mvn clean install -PautoInstallPackage -e`, I get the following message: 

 

 

[ERROR] The analyser found the following errors for author and publish : 
[ERROR] [api-regions-exportsimports] com.importer.aem:importer-aem-project.core:5.0.0-SNAPSHOT: Bundle importer-aem-project.core:5.0.0-SNAPSHOT is importing package(s) [com.exporter.aem.core.services, com.exporter.aem.core.exceptions] in start level 20 but no bundle is exporting these for that start level. (IMPORTER:importer-aem-project.importer.all:5.0.0-SNAPSHOT)

 

 

If I disable the plugin at root pom.xml using code below, then the error disappears, and my Servlet is able to use the OSGi service fine. But of course I don't want to skip it. 

 

<aemanalyser.version>1.5.8</aemanalyser.version>
<aem.analyser.skip>true</aem.analyser.skip>

 

Could anyone explain what I am missing, or how to export the bundle with the proper start level?

I looked here and here, but couldn't understand as their issues seem to relate more to importing a third party package whereas mine is about importing from another Maven project of mine...I am still new to AEM as a Cloud Service.

Thank you,
1 Accepted Solution

Avatar

Correct answer by
Level 3
This is caused by the fact that `aemanalyser-maven-plugin` does not take into account the interdependencies between the projects when ran separately.

So to fix this, we have to use a separate "analyse" module that has for dependency the "all" modules of both projects, as per the "Example for a Multi Project Setup" of README documentation.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3
This is caused by the fact that `aemanalyser-maven-plugin` does not take into account the interdependencies between the projects when ran separately.

So to fix this, we have to use a separate "analyse" module that has for dependency the "all" modules of both projects, as per the "Example for a Multi Project Setup" of README documentation.