Monday, July 28, 2014

How to include all CQ dependencies in CQ6

Use case: Prior to CQ6 you have to add dependencies for each class you are using in your pom.xml, Way to find dependencies was (Maven org http://mvnrepository.com or using adobe central http://repo.adobe.com/nexus/content/groups/public through dependency finder HOST:PORT/system/console/depfinder). With CQ6 now all dependencies are provided through one artifactID.

Prerequisite: Maven, CQ Project Set Up 

Solution: Include following line in your dependency management for your pom.xml (Depending upon project this could be at any location usually it is your Project parent pom)


<dependencyManagement>
<!-- All Your Third party dependency -->
<!-- AEM 6.0 -->

      <!-- All AEM Dependencies for JSP compilation -->

      <dependency>
        <groupId>com.adobe.aem</groupId>
        <artifactId>aem-api</artifactId>
        <version>6.0.0.1</version>
        <scope>provided</scope>
      </dependency>

      <!-- All AEM 6.1 Dependency added to end of file -->


      <dependency>
        <groupId>com.adobe.cq.social</groupId>
        <artifactId>cq-socialcommunities-api</artifactId>
        <version>1.7.197</version>
        <scope>provided</scope>
      </dependency>


      <dependency>
        <groupId>com.adobe.aem</groupId>
        <artifactId>uber-jar</artifactId>
        <version>6.1.0</version>
        <scope>provided</scope>
        <classifier>obfuscated-apis</classifier>
      </dependency>


</dependencyManagement>

Note that this version could change depending upon new releases of CQ, You can track them from http://repo.adobe.com/nexus/content/repositories/releases/com/adobe/aem/aem-api/

Some Trick: Note that above will include all AEM-API dependencies, other way to check what minimum dependency is needed is to create a multi module project using AEM plugin for eclipse more example http://docs.adobe.com/content/docs/en/dev-tools/aem-eclipse.html .

You can also upload uber-jar with apis classifiers instead of obfuscate-apis classifier to your Nexus or dependency management system. 

To upload this uber-jar to your nexus you can use something like,

mvn deploy:deploy-file -Durl=YOUR-REPO -Dfile=uber-jar-6.1.0-apis.jar -DartifactId=uber-jar -Dversion=6.1.0 -DgroupId=com.adobe.aem -Dclassifier=apis -Dpackaging=jar -DrepositoryId=YOUR-REPO-ID

Once you have uber-jar with apis classifier ready, You can use something like

      <dependency>
        <groupId>com.adobe.aem</groupId>
        <artifactId>uber-jar</artifactId>
        <version>6.1.0</version>
        <classifier>apis</classifier>
        <scope>provided</scope>
      </dependency>


I see that minimum these are needed when you use this,

As always let me know if you want me to add more details in this posting.

10 comments:

  1. Hi Yogesh,

    In minimum recommendation section:

    <dependency>
    <groupId>org.osgi</groupId>
    <artifactId>org.osgi.core</artifactId>
    </dependency>

    <dependency>
    <groupId>org.osgi</groupId>
    <artifactId>org.osgi.compendium</artifactId>
    </dependency>

    why is this used, instead of:

    <dependency>
    <groupId>org.apache.felix</groupId>
    <artifactId>org.osgi.core</artifactId>
    <version>1.4.0</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.apache.felix</groupId>
    <artifactId>org.osgi.compendium</artifactId>
    <version>1.4.0</version>
    <scope>provided</scope>
    </dependency>

    I always assumed felix was the better solution but now I'm not sure.

    What are the benefits/loses of using the recommended group?

    ReplyDelete
    Replies
    1. Hello Mathew,
      Thanks for recommendation. Changed my posting. Felix should be right one in this case.
      Yogesh

      Delete
  2. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Project Centers in Chennai for CSE.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

    ReplyDelete
  3. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! @ Packers and Movers Ahmedabad

    ReplyDelete

  4. Enhance Performance Of Printing Device With Canon Printer Support
    If you want to get Canon Printer Support directly from a team of certified professionals and engineers, then make use of round the clock working support system and get rid of all such problems which are affecting performance of the canon printer and also help you to have error free experience without any hassle

    ReplyDelete
  5. Use Brother Pinter Support To Resolve Miscellaneous Error Messages
    Are you looking to resolve miscellaneous error messages appeared on the computer system due to problematic Brother Printer Support? If really so, then you should get in touch with certified professionals who will without a doubt help you out in a couple of seconds and also assist you to have an error free experience

    ReplyDelete
  6. Bolavita - Situs Taruhan Bola | Live Casino | Sabung Ayam Online | Slot Games |Togel Online Aman Dan Terpercaya

    Minimal Depo & WD Hanya IDR 25.000,- *

    Melayani Deposit Pulsa Telkomsel | XL | Gopay | OVOpay |LinkAja | DANA Serta Semua Bank Indonesia

    Bonus Untuk Member Baru Rp.500.000,-
    Bonus New Member IDR 500.000

    Bonus Cashback Mingguan Hingga 10%
    Bonus Cashback 10%

    Promo Deposit Spesial Happy Friday
    Bonus Flash Deposit Spesial Hari Jumat( Happy Friday)

    Bonus Kemenangan 100% 8x Win Berturut turut
    Bonus 8x 9x 10 Win Sabung Ayam S128 SV388

    Bonus Kemenangan Beruntun Sexy Baccarat
    Bonus 8x Win Sexy Baccarat Casino Online

    Promo Bonus Natal & Tahun Baru Bolivata 2020
    Hadiah Utama Samsung S10

    Kontak :
    • Telegram : https://t.me/bolavita
    • WA Bolavita : https://wa.me/+628122222995/
    • Wechat : Bolavita
    • Line : cs_bolavita

    ReplyDelete