Expand my Community achievements bar.

How to create Osgi bundle in AEM 6.4

Avatar

Level 2

Hello friend

I am new to AEM and trying to create a OSGi bundle so i found 2 ways to do it

1. Crx/de

2. Maven command.

and follow links below :

Adobe Experience Manager Help | Creating OSGi bundles for the Adobe Digital Marketing Suite using CRXDE

Adobe Experience Manager Help | Creating your first Adobe Experience Manager Service using an Maven Archetype project

Respectively for crx/de and maven .

so as far as i have researched we cannot create bundle in 6.4 using Crx/de(please tell me if we can?) so now when i am following the second way using maven i am stuck on the step four which is creation of project using command and i am using the following command :

mvn archetype:generate

-DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/

-DarchetypeGroupId=com.day.jcr.vault

-DarchetypeArtifactId=multimodule-content-package-archetype

-DarchetypeVersion=1.0.2

-DgroupId=com.adobe.cq

-DartifactId=key61

-Dversion=1.0-SNAPSHOT

-Dpackage=com.adobe.cq

-DappsFolderName=myproject

-DartifactName="My Project"

-DcqVersion="6.4"

-DpackageGroup="My Company"

Also i am not sure about the setting.xml which they are coping to the user profile in step 3, That what is the use of doing it ?

Please help on this.

Thanks in Advance

13 Replies

Avatar

Community Advisor

Hi,

Please check

Creating an Adobe Experience Manager 6.4 Project using Adobe Maven Archetype 13

settings.xml is used to do global changes for maven similar like POM.xml

In above tutorials adobe public repo is added to download dependencies hosted to adobe public repo instead of maven repo.



Arun Patidar

Avatar

Level 2

Thanks for the reply.

But in the above tutorial if you see there are two folder which are getting created i.e. content and bundle but in our case of AEM 6.4 i am getting 5 folders core, test, content, app and launcher,

so where i have to write the code for keyservice interface and keyserviceImpl.

Avatar

Community Advisor

HI Yash

   The correct way to create an AEM project is to use either Maven or Lazybones. Since you are starting with the AEM development , I would recoomend you to go with Maven. You can follow the link Arun mentioned.Now to answer your question specifically , when you create a project using Maven command , it actually create an initial structure for you. Depending on the archetype you are using it will generate the folder structures for you. So when you create your initial project , you will have a structure something like below

1573923_pastedImage_0.png

To brief you

core - all your backend code will be inside this folder

it.launcher - Your AEM integration tests can go here

it.tests - Integration tests

ui.apps - this will have the components , (In simple words your apps)

ui.content - this can have content, conf and anything which facilitate content

        All your java coding should go inside your core folder. When you import your maven project to eclipse , it will have a structure similar to below.

1573924_pastedImage_2.png and all the java coding will go inside , in this case , utilities.core .

1573937_pastedImage_3.png  also , since you are starting with AEM development,. your initial code base will have a set of sample code for you to understand different modules like servlets , services, schedulers so and so. 

If you need more info , please let us know. Happy coding . And welcome to AEM world 

Thanks

Veena

Avatar

Community Advisor

Also, could you please specify where exactly you are stuck in the below ?

Avatar

Level 10

In AEM 6.x - never use CRXDE lite to create OSGi bundles. Always use a Maven Archetype.

Creating an Adobe Experience Manager 6.4 Project using Adobe Maven Archetype 13

Also - as you are new to AEM -- see Getting Started with AEM-Sites

Please start with this article too -- Getting Started with AEM Sites - WKND Tutorial (This will teach you how to really get up and running with AEM)

Avatar

Level 10

Also when you use HELPX articles - please refer to the version.

One of the issues you have is you are trying to use an article meant for AEM 5.5 on 6.4. See below. Always match the article version with the AEM version.

OSGi.png

Avatar

Level 2

Hello friend

By the help of your resources i have created a project and has the bundle in my web console under osgi> bundle.

but now i want to see how two component communicate with each other,

so what should be the steps to check that.

Please help

Thanks in advance

Avatar

Level 10

I am not sure what you mean, Can you describe what you want two separate components to do?

Avatar

Level 2

Hello

Actually what i am assuming is that an osgi bundle is a separate module which can be used independently in AEM.

so i want to make a login module which can be then used with other projects.

so for this

1. I want to know how and where to start my login module

2. how this module can be used with other projects.

Avatar

Community Advisor

You can deploy both bundles independently from eclipse or Felix console and can use like other bundle e.g. log



Arun Patidar

Avatar

Community Advisor

Hi,

OSGi components can be made as OSGi service . When you mark a component as service, you could refer (call) this service from other osgi components.

Please check below:

Creating an Adobe Experience Manager 6.4 Project using Adobe Maven Archetype 13



Arun Patidar