Experience League Showcase
Read real-world use cases of Experience Cloud products written by your peers
Adobe Feedback Program
Influence Adobe product development
COMMUNITIES BY PRODUCT
Advertising
Analytics
Audience Manager
Campaign Classic v7 & Campaign v8
Campaign Standard
Developer
Experience Cloud
Experience Manager Sites & More
Experience Platform
Journey Optimizer
Target
Real-Time Customer Data Platform
Workfront
Marketo Engage
Hi All,
I'm trying to add JSOUP to my maven project in order to do that i followed the below steps.
I have read few articles and tried to embed the JSOUP JAR in AEM but its not working.
Could you please provide an step by step instruction for adding 3rd party library (JSOUP) in AEM Maven Project.
Core POM.xml:
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version> <scope>provided</scope>
</dependency>
After adding Dependency i tried cleaning and building the project but I'm getting the below error in All Bundle.
ERROR :
[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.carrybag:carry-bag.core:1.0.0-SNAPSHOT: Bundle carry-bag.core:1.0.0-SNAPSHOT is importing package(s) [org.jsoup.nodes, org.jsoup, org.jsoup.select] in start level 20 but no bundle is exporting these for that start level. (com.carrybag:carry-bag.all:1.0.0-SNAPSHOT)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Carry Bag 1.0.0-SNAPSHOT:
[INFO]
[INFO] Carry Bag .......................................... SUCCESS [ 0.865 s]
[INFO] Carry Bag - Core ................................... SUCCESS [01:11 min]
[INFO] Carry Bag - UI Frontend ............................ SUCCESS [04:17 min]
[INFO] Carry Bag - Repository Structure Package ........... SUCCESS [ 4.149 s]
[INFO] Carry Bag - UI apps ................................ SUCCESS [ 36.522 s]
[INFO] Carry Bag - UI content ............................. SUCCESS [ 26.174 s]
[INFO] Carry Bag - UI config .............................. SUCCESS [ 1.516 s]
[INFO] Carry Bag - All .................................... FAILURE [01:45 min]
[INFO] Carry Bag - Integration Tests ...................... SKIPPED
[INFO] Carry Bag - Dispatcher ............................. SKIPPED
[INFO] Carry Bag - UI Tests ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:30 min
[INFO] Finished at: 2024-04-06T22:00:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.adobe.aem:aemanalyser-maven-plugin:1.4.10:project-analyse (aem-analyser) on project carry-bag.all: One or more feature analyser(s) detected feature error(s), please read the plugin log for more details -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :carry-bag.all
Hi Hari,
I too faced this jsoup issue long back on that time I added the dependencies in main pom file
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
<scope>provided</scope>
</dependency>
and added this one core pom file
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
</dependency>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,!org.osgi.framework,*
-includeresource: jsoup*.jar;lib:=true
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
So try out this one will works for your case
Thanks
Nandheswara
Hi
@HariDo
,
This should work fine. I tried it in a project which is using jsoup with the same dependency and hopefully I am not getting any error. Please share the mvn command you are using and make sure you doing "Load maven changes" when you add the dependency in core's pom by clicking the icon
or pressing ctrl+shift+O (if you are using intellij). For other compilers you can google how to load maven changes.
Add the JSOUP dependency to your project's POM.xml file:
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
Build your project using the following command:
mvn clean install -PautoInstallPackage
Check the Maven build output for any errors related to the JSOUP dependency. If there are no errors, the JSOUP JAR file should be included in your AEM package.
If you encounter the error you mentioned in your question, it means that the AEM Analyser plugin detected that your bundle is importing packages that are not exported by any other bundle. To fix this error, you can add the following instructions to your bundle's pom.xml file:
<instructions>
<Export-Package>
<!-- Export all packages in your bundle -->
</Export-Package>
<Import-Package>
<!-- Import the required packages from JSOUP -->
org.jsoup.nodes,
org.jsoup,
org.jsoup.select,
</Import-Package>
</instructions>
This will export all packages in your bundle and import the required packages from JSOUP. Make sure to include the *
wildcard character to import all other required packages.
Rebuild your project using the mvn clean install -PautoInstallPackage command and check the Maven build output for any errors. If there are no errors, the JSOUP library should be successfully included in your AEM package.
Hi @Raja_Reddy
I have added the dependency in my core pom.xml file
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
after adding dependency i cleaned and build my project using "mvn clean" then " mvn clean install -PautoInstallPackage -DskipTests=true" and got a build failure in all module as mentioned in the post description.
then as you mentioned i have added the instructions to my core pom.xml file.
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,*
]]></bnd>
<instructions>
<Export-Package>
com.carrybag.core,
</Export-Package>
<Import-Package>
org.jsoup,
org.jsoup.nodes,
org.jsoup.select,
</Import-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
I'm still getting the same error, Could you please check and let me know if I'm missing anything.
Error:
[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.carrybag:carry-bag.core:1.0.0-SNAPSHOT: Bundle carry-bag.core:1.0.0-SNAPSHOT is importing package(s) [org.jsoup.nodes, org.jsoup, org.jsoup.select] in start level 20 but no bundle is exporting these for that start level. (com.carrybag:carry-bag.all:1.0.0-SNAPSHOT)
This is because of the aemanalyser-maven-plugin.
Please refer to the below links -
Bundle XXX is importing package(s) [YYY, ZZZ] in start level 20 but no bundle is exporting these for...
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/getting-error-while-buildi...
Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS
Hope this helps!
Hi Hari,
I too faced this jsoup issue long back on that time I added the dependencies in main pom file
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
<scope>provided</scope>
</dependency>
and added this one core pom file
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
</dependency>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,!org.osgi.framework,*
-includeresource: jsoup*.jar;lib:=true
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
So try out this one will works for your case
Thanks
Nandheswara