Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Maven Dependency - Service

aemd25900338
Level 3
Level 3

HI All,

I have created a service org.testsite.myconfig.MyConfigService. Now I have to call this service in another service com.aem.DeviceDetection.  As  MyConfigService service doesn't exist in Adobe repository, how should this dependency be managed in Maven project. Are there special entries which need to be added in pom.xml for this project?

TIA

AEM 6.0

1 Reply
kautuk_sahni
Community Manager
Community Manager

Hi 

Please refer to these articles for your references.

Link:- https://helpx.adobe.com/experience-manager/using/restful-services.html

//This articles covers how to create and deploy an Adobe CQ OSGi bundle that consumes data from a third-party Restful web service.

Link:- http://www.wemblog.com/2012/04/how-to-integrate-3rd-party-jar-file-in.html

~kautuk

aemd25900338
Level 3
Level 3

Thanks but my problem is slightly different from these references. These links tell how to convert a normal JAR file to OSGI bundle but in my case i already have the OSGI bundle. 

I have an OSGI bundle A (custom) which I want to import to another OSGI bundle B. As this bundle A is not in Adobe repository, i am keeping bundle A jar file under the lib folder of project B in eclipse. It works till this point (First question is: Is this the best way of adding custom OSGI Bundle in eclipse project?)

After this I run mvn clean install so that I can create bundle file from Project B but it fails saying that

[ERROR] Failed to execute goal on project B-bundle: Could not resolve dependencies for project com.B-bundle:bundle:1.0-SNAPSHOT: Could not find artifact org.testsite.myconfig:org.testsite.myconfig.MyConfigService:jar:1.0.0 in adobe (http://repo.adobe.com/nexus/content/groups/public/) -> [Help 1]
 

Clearly when running above command, Maven doesn't see the dependency A added through the lib folder of project B. 

So another question is , what can i do to resolve above problem?

TIA 

dragon2A
Level 6
Level 6

Hi,

I have an OSGI bundle A (custom) which I want to import to another OSGI bundle B. As this bundle A is not in Adobe repository. I am keeping bundle A jar file under the lib folder of project B in eclipse. It works till this point (First question is: Is this the best way of adding custom OSGI Bundle in eclipse project?) 

While building the Project A can install the OSGI bundle in AEM. By using that reference u can build the Project B. keeping the jar file in library is not a good idea. 

 

Thanks

Uma

Singaiah_Chintalapudi
Community Advisor
Community Advisor

You can place a bundle A jar in a repository that you are using. Add this dependency in bundle B pom and add the following under plugins ---> configuration section.

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>.

This should work.

Jörg_Hoh
Employee
Employee

Hi,

if you use the standard AEM project setup (maybe using the respective maven archetype), you should have all custom code in a single bundle. In that case you don't need to change the POM to reference your own service. If you use multiple bundles, you need to create the dependencies in the POM (as you would reference product services).

Jörg