Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM 6.5 - Can't import dependency to my AEM project

Avatar

Level 2

Hello there.
I'm totally new to this world, same for Maven/Java so please be kind with me. I'm trying to import Opencsv to my project since I've to read some csv files and I saw it's easy to implement. I tell you what I'm currently doing to import it:
- Went to Maven online repository > Opencsv

- Added this snippet opencsv.PNG in my core pom.xml

- Wrote some code to read my csv
Tried to build but I got this error:
[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] it.censored:aem-censored-project.core:1.0.0-SNAPSHOT: Bundle aem-censored-project.core:1.0.0-SNAPSHOT is importing package(s) [com.opencsv.exceptions, com.opencsv, com.opencsv.bean] in start level 20 but no bundle is exporting these for that start level. (it.censored:aem-censored-project.all:1.0.0-SNAPSHOT).


At first I thought maybe this dep was not compatible with my project and I tried to add a similar dep but same result. Can you help me? What am I doing wrong? I can screenshare or post more info if you need it. Thanks

 

8 Replies

Avatar

Community Advisor

In your core pom.xml , could you try Embed Dependency along with other configuration and see?

 

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>commons-csv</Embed-Dependency>

 

Avatar

Level 2

Thanks for your answer, I added this snippet here(the green part), but same error. If it's ok to you I can screenshare it so I can show it you better.pom.PNG

 

Avatar

Level 2

Thank you for your answer, I already saw that post but I don't really know if I did something wrong. It would be easier for me if I could show you my screen!

 

Avatar

Community Advisor

Hi @Lezzowski ,

 

please add this dependency on the main pom file:

<!-- Open CSV Dependencies -->
            <dependency>
                <groupId>com.opencsv</groupId>
                <artifactId>opencsv</artifactId>
                <version>5.7.0</version>
            </dependency>

add this to your core pom file:

<dependency>
       <groupId>com.opencsv</groupId>
       <artifactId>opencsv</artifactId>
</dependency>

Try importing your project to a IDE, IntelliJ/Eclipse which could resolve dependencies by downloading the dependencies before the build.

Avatar

Level 2

Hello @B_Sravan ,

I'm using IntelliJ but unfortunately I'm still receiving the same error. If it's ok to you I can screenshare, I'll wait for your reply

 

 

Avatar

Community Advisor

sure, please DM me, we can connect and look into the issue.