AEM Import and Export Bundle

Avatar

Avatar
Validate 1
Level 1
sg08
Level 1

Likes

0 likes

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
sg08
Level 1

Likes

0 likes

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
sg08
Level 1

02-06-2020

Hi,

Can someone explain to me what changes need to be made in a maven project so that we can import and export bundles.

Let's say I have a bundle - com.abc

I want to use some classes of the abc bundle in a different bundle - com.pqr

So I will need to export the com.abc bundle (maybe by modifying the pom file) and also import the bundle in com.pqr (by importing the abc bundle in pom file).

What exactly are the changes I need to make to the pom file in order to do this? I see that there is option to add dependency in the file but also to import a package so I am really confused. Some help here on what to do in the pom file would be very much appreciated.
Thanks.

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 5
Employee
sunjot16
Employee

Likes

106 likes

Total Posts

164 posts

Correct reply

50 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile

Avatar
Give Back 5
Employee
sunjot16
Employee

Likes

106 likes

Total Posts

164 posts

Correct reply

50 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile
sunjot16
Employee

02-06-2020

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
MVP
ArpitVarshney
MVP

Likes

136 likes

Total Posts

185 posts

Correct reply

36 solutions
Top badges earned
Validate 1
Establish
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
MVP
ArpitVarshney
MVP

Likes

136 likes

Total Posts

185 posts

Correct reply

36 solutions
Top badges earned
Validate 1
Establish
Give Back 5
Give Back 3
Give Back 25
View profile
ArpitVarshney
MVP

02-06-2020

Hi @sg08 

 

You need to understand the concept of the Bundle Resolution Rule in OSGi.This is very well explained in this link.

https://blog.christianposta.com/osgi/understanding-how-osgi-bundles-get-resolved-part-i/

 

Regards,

Arpit Varshney

Avatar

Avatar
Give Back 3
Employee
Manish_Singh_1
Employee

Likes

15 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Give Back 3
Give Back
Boost 5
Boost 3
Boost 10
View profile

Avatar
Give Back 3
Employee
Manish_Singh_1
Employee

Likes

15 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Give Back 3
Give Back
Boost 5
Boost 3
Boost 10
View profile
Manish_Singh_1
Employee

02-06-2020

Your bundle should be exporting the class which can be consumed by other bundles. if you use the @service annotation, it will expose your class as a OSGI service