Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Maven Dependency - Service

Avatar

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

6 Replies

Avatar

Administrator

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



Kautuk Sahni

Avatar

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 

Avatar

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

Avatar

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.

Avatar

Employee Advisor

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