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.
SOLVED

Is it possible to have multiple OSGI bundles in 1 project? If yes, how?

Avatar

Level 9

As above.

 

as an example: I want to have  2 bundles ((com.myhost.www.core1 and com.myhost.www.core2) in my project. This means if I go to /system/console/bundles, both core1 and core2 are listed.

-------

from what I understand, the OSGI bundle is basically the jar version of the core folder.

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @jayv25585659 

Yes, it is possible to have multiple OSGi bundles in one project. Kindly follow below steps to achieve as per your above requirement

1. Typically create separate maven projects next to the core maven project
                                                      OR
   Copy core module paste parallel to core and rename to core2, do change in pom.xml accordingly.

<parent> 
<groupId>training</groupId>
<artifactId>training</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>com.myhost.www.core2</artifactId>
<packaging>bundle</packaging>
<name>AEM Training OSGI - Core 2</name>
<description>Core bundle for training</description>

2.Embed it to ui.apps pom.xml 

<embedded>
<groupId>training</groupId>
<artifactId>com.myhost.www.core2</artifactId>
<target>/apps/training/install</target>
</embedded>

3. Add dependency to ui.apps pom.xml 

<dependency>
<groupId>training</groupId>
<artifactId>com.myhost.www.core2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>


Github Reference: https://github.com/sansai2011/training 

 

To understand in details, how can it be done please visit my blog here https://www.techinnovia.com/package-import-and-export/ where I have created multiple bundles in one single project as shown in below picture.

image-19.png











Also would suggest you to go through this https://youtu.be/flIp_1o4Nt0 video clip (belongs to same article) for better understanding.

Hope that helps you!

Regards,
Santosh

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @jayv25585659 

Yes, it is possible to have multiple OSGi bundles in one project. Kindly follow below steps to achieve as per your above requirement

1. Typically create separate maven projects next to the core maven project
                                                      OR
   Copy core module paste parallel to core and rename to core2, do change in pom.xml accordingly.

<parent> 
<groupId>training</groupId>
<artifactId>training</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>com.myhost.www.core2</artifactId>
<packaging>bundle</packaging>
<name>AEM Training OSGI - Core 2</name>
<description>Core bundle for training</description>

2.Embed it to ui.apps pom.xml 

<embedded>
<groupId>training</groupId>
<artifactId>com.myhost.www.core2</artifactId>
<target>/apps/training/install</target>
</embedded>

3. Add dependency to ui.apps pom.xml 

<dependency>
<groupId>training</groupId>
<artifactId>com.myhost.www.core2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>


Github Reference: https://github.com/sansai2011/training 

 

To understand in details, how can it be done please visit my blog here https://www.techinnovia.com/package-import-and-export/ where I have created multiple bundles in one single project as shown in below picture.

image-19.png











Also would suggest you to go through this https://youtu.be/flIp_1o4Nt0 video clip (belongs to same article) for better understanding.

Hope that helps you!

Regards,
Santosh

Avatar

Community Advisor

@jayv25585659 
Yes, You can have bundles with same Symbolic Name and different versions. You can have in parallel. But what is your use case. What are you trying to achieve with 2 bundles.