Expand my Community achievements bar.

SOLVED

Getting error while building maven project " Bundle aem-digital.core:1.0.0-SNAPSHOT is importing package(s) com.fasterxml.jackson.dataformat.csv in start level 20 but no bundle is exporting these for that start level."

Avatar

Level 4

Hi All,

 

I have created AEM a cloud project using below archtype

 

mvn -B archetype:generate -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=30 -D appTitle="Digital Site" -D appId="digitalsite" -D artifactId="aem-digital" -D groupId="com.digital" -D aemVersion=cloud -D includeDispatcherConfig="y"

 

 

I have added some project specific dependency 

 

		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-csv</artifactId>
			<version>2.11.4</version>
		</dependency>

 

 

But while  building the project I am getting error 

 

 

[WARNING] The analyser found the following warnings for author and publish :
[WARNING] [artifact-rules] artifact-rules: Artifact rules are not specified, unable to validate feature
[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.digital:aem-digital.core:1.0.0-SNAPSHOT: Bundle aem-digital.core:1.0.0-SNAPSHOT is importing package(s) com.fasterxml.jackson.dataformat.csv in start level 20 but no bundle is exporting these for that start level. (com.digital:aem-digital.all:1.0.0-SNAPSHOT)

 

 

Can please help me here How I can resolve this error??

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@codingStar 

This is because of the aemanalyser-maven-plugin that gets executed in all module of the project which run the same checks locally as in the Cloud Manager deployment pipeline. 

Vijayalakshmi_S_1-1638623883632.png

More about the plugin : https://github.com/adobe/aemanalyser-maven-plugin/blob/main/aemanalyser-maven-plugin/README.md

For the reported analyzer error,

Whole list of analyzers that are executed as part of this plugin : https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetyp...

View solution in original post

11 Replies

Avatar

Employee Advisor

if you just add the dependency to the pom, this additional JAR is used while compilation and test. But it is not included into the runtime, and therefor this validation process fails.

You either need to embed this dependency into your own bundle, or you find an OSGI-version of that bundle and deploy it along with your core bundle.

Avatar

Level 4

Jörg_Hoh I have tried to add below in core pom.xml but still getting same error.

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>4.2.1</version>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            <Export-Package>com.fasterxml.jackson.*</Export-Package>
            <Embed-Dependency>jackson-dataformat-csv;scope=compile|runtime</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Import-Package>
                com.fasterxml.jackson.*
            </Import-Package>
        </instructions>
    </configuration>
</plugin> 

  

Avatar

Employee Advisor

I would drop the Export-Package, because you don't want to re-export any jackson package. The Embed-Dependency looks ok, although you can probably omit the scope statement.

 

Can you check if the jackson-dataformat.csv jar is placed within the target/classes folder after the build?

Avatar

Community Advisor

Add the dependency to your core bundle and that should clean this error.

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
</dependency>


I tried it too and the build is successful.

Screenshot 2021-12-03 at 12.54.09 PM.png

Avatar

Level 4

@B_Sravan  I have already added dependency in main pom as well as in core pom gettig error while running below build command

mvn clean install -PautoInstallPackage

Main pom.

		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-csv</artifactId>
			<version>2.11.4</version>
		</dependency>

Core pom

            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-csv</artifactId>
            </dependency>

Avatar

Community Advisor

Hi,

This error type means

 

Checks if all OSGI bundles have their Import-Package declarations satisfied by the Export-package declaration of other included bundles in the Maven project. An error would look like this:

 

[ERROR] org.acme:mybundle:0.0.1-SNAPSHOT: Bundle org.acme:mybundle:0.0.1-SNAPSHOT is importing package(s) org.acme.foo in start level 20 but no bundle is exporting these for that start level.

 

To troubleshoot, see if the bundle providing the package is included in the deployment, or alternatively look at the manifest of the bundle that you would expect to be exporting to determine if the wrong name or wrong version was used.

 

 



Arun Patidar

Avatar

Level 4

@arunpatidar  I am getting this just after adding below dependency which I am using on servlet class. And I am getting this error even run mvn clean install

Avatar

Correct answer by
Community Advisor

@codingStar 

This is because of the aemanalyser-maven-plugin that gets executed in all module of the project which run the same checks locally as in the Cloud Manager deployment pipeline. 

Vijayalakshmi_S_1-1638623883632.png

More about the plugin : https://github.com/adobe/aemanalyser-maven-plugin/blob/main/aemanalyser-maven-plugin/README.md

For the reported analyzer error,

Whole list of analyzers that are executed as part of this plugin : https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetyp...

Avatar

Administrator

@codingStar 

[Webinar | AEM GEMs] Looking under the hood - Cloud Manager 2022 | Register: https://adobe.ly/3t4jfgp  & Ask Questions related to this Webinar: https://adobe.ly/3O0rdzd 

Date &Time: Wednesday, June 15, 2022 - 8 am PDT OR 5 pm CET OR 8.30 pm IST
Speakers: Remus Stratulat & Shankari Panchapakesan

Share this within your Organisation and with your AEM peers!!



Kautuk Sahni

Avatar

Level 1

I'm having this same issue, but for "internal" dependencies. We have a multi-tenant project setup like below:

  • project-root
    • all - embeds parent.all.zip, tenant-a.all.zip, tenant-b.all.zip
    • parent (shared Java and HTL)
      • all - embeds parent.core.jar, parent.ui.apps.zip, parent.ui.config.zip, parent.ui.content.zip
      • core
      • ui.apps
      • ui.apps.structure
      • ui.config
      • ui.content
    • tenant-a
      • all - embeds tenant-a.core.jar, tenant-a.ui.apps.zip, tenant-a.ui.config.zip, tenant-a.ui.content.zip
      • core - has dependency for parent.core
      • ui.apps
      • ui.apps.structure
      • ui.config
      • ui.content
      • ui.frontend
    • tenant-b
      • all - embeds tenant-b.core.jar, tenant-b.ui.apps.zip, tenant-b.ui.config.zip, tenant-b.ui.content.zip
      • core - has dependency for parent.core
      • ui.apps
      • ui.apps.structure
      • ui.config
      • ui.content
      • ui.frontend
    • dispatcher

 

my "tenant-#.all" modules are failing during aem-analyser because their embeded "tenant-#.core" jars are importing packages from "parent.core", but no bundles are exporting those packages...

 

 

[ERROR] [api-regions-exportsimports] com.project.namespace:tenant-a.core:1.0.0-SNAPSHOT: Bundle tenant-a.core:1.0.0-SNAPSHOT is importing package(s) [com.project.namespace.parent.core.models, com.project.namespace.parent.core.models.marketo] in start level 20 but no bundle is exporting these for that start level. (com.project.namespace:tenant-a.all:1.0.0-SNAPSHOT)

 

 

Previously, I had parent.all.zip defined as an embed in my tenant-#.all packages like:

 

 

<embedded>
    <groupId>com.project.namespace</groupId>
    <artifactId>parent.all</artifactId>
    <type>zip</type>
    <target>/apps/parent-packages/container/install</target>
</embedded>

 

 

Which allowed my build to pass and deployed functionality worked fine, however it caused a "PackageOverlaps" bug in our Adobe CM pipeline scans, which is what I'm trying to resolve now.

I have confirmed that the parent.core bundle manifest is exporting the required packages, so I don't understand why tenant-#.all analysis is failing for tenant-#.core. And yes, the tenant-#.core modules are including parent.core as a dependency.

Maybe I'm approaching this incorrectly, but I am trying to keep the tenant modules from deploying parent modules, since the parent modules are being deployed already (project-root.all -> parent.all -> parent.core). How can I inform aemanalyser in "submodule" that it's dependencies are deployed or are deploying?