Latest Posts


Showing posts with label cq5 project. Show all posts
Showing posts with label cq5 project. Show all posts
CRXDE lite is a nice little IDE for creating UI stuff like templates and dialogs. The browser based interface cannot match up to IDE's like Eclipse. Also writing Java code (Bundles) in crxde lite  is a major pain. Adobe has a solution for this , they have defined a Maven archetype that creates a maven project independent of IDE's. With maven plugins for Apache Sling and Apache Felix writing code is a lot simpler.

The sample maven command to create a cq5 project is

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=cq5tutorials  -DartifactId=myCqMavenproject -Dversion=1.0-SNAPSHOT -Dpackage=com.blogspot.cq5tutorials  -DappsFolderName=myCqMavenproject  -DartifactName="my Cq Maven project"   -DcqVersion="5.6.1"  -DpackageGroup="com.blogspot.cq5tutorials"



Run this MVN command and import it as a maven project into eclipse.[ If you get Mojo failure exception when running the command, try deleting the jar mentioned in error message from M2 repository and re running the command]. After the command is successfully executed import the project into Eclipse. You'll see three folders viz, the main folder (same name as your artifactId), content folder and the bundle folder.

The project is divided into two modules

1) Content : This will have all the UI elements like templates, template renders, components , client libraries and so on. The apps folder of your project will be in this module. You can also include etc and other folders. The content folder maps with jcr:root of the repository hence you can use vault tool to import and export data from eclipse to your repository. Since the repository is made of nodes this is translated into xml files and folders to convert them to native file system in eclipse.

2)Bundle: Since Cq5 uses OSGI architecture all your java classes will be written as OSGI components and services , these are then packaged in a bundle which export the functionality to be used in the UI elements. All your Servlets, filters , schedulers, taglibs will be written inside this folder.

The structure of project is very important in cq5 as the software allows overriding of the base(foundation) functionalities easily by replicating the structure inside your project.

The  commonly used structure is as shown in the below diagram

These are some of the folders present in the root of the cq's tree.

The libs folder as the name says is the library folder of the software.It contains the code for most of cq's functionality; most important from developers point of view among the folders is FOUNDATION folder.

The foundation folder contains all the OOTB components and is often used by developers to extend the components.