You can use Maven to build an OSGi bundle that contains a Sling Servlet. Maven manages required JAR files that a Java project needs in its class path. Instead of searching the Internet trying to find and download third-party JAR files to include in your project’s class path, Maven manages these dependencies for you.
You can download Maven 3 from the following URL:
http://maven.apache.org/download.html
After you download and extract Maven, create an environment variable named M3_HOME. Assign the Maven install location to this environment variable. For example:
C:\Programs\Apache\apache-maven-3.0.4
Set up a system environment variable to reference Maven. To test whether you properly setup Maven, enter the following Maven command into a command prompt:
%M3_HOME%\bin\mvn -version
This command provides Maven and Java install details and resembles the following message:
Java home: C:\Programs\Java64-6\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Create an Adobe CQ archetype project
To create an Adobe CQ archetype project, perform these steps:
1. Open the command prompt and go to your working directory (for example, C:\AdobeCQ).
2. Run the following Maven command:mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=adobe-public-releases
3. When prompted for additional information, specify these values:
- groupId: com.adobe.cq.sling
- artifactId: claim
- version: 1.0-SNAPSHOT
- package: com.adobe.cq.sling
- appsFolderName: adobe-training
- artifactName: Claim Training Package
- packageGroup: adobe training
- confirm: Y
4. Once done, you will see a message like:
[[INFO] Total time: 14:46.131s [INFO] Finished at: Wed Mar 27 13:38:58 EDT 2013 [INFO] Final Memory: 10M/184M