Ensure
- AEM is up and running on http://localhost:4502/
- Java 1.5 or greater and Maven 3.0.4 or greater are
installed
- you are connected to the internet
Several Maven
archetypes are available for generating CQ projects. Use the archetype that
corresponds with your development goals:
·
A content package that installs resources for a
CQ application: simple-content-package-archetype
·
A content package that includes third-party
artifacts: simple-content-package-with-embedded-archetype.
·
A multi-module application that
accomodates the development of Java classes and unit tests: multimodule-content-package-archetype.(described above)
Both 1 and 2nd archetype above doesn’t allow for java devt. They only create a folder structure for creating cq components. So if the project has java classes then they should go for only 3 - multimodule-content-package-archetype.
SIMPLE-CONTENT-PACKAGE-ARCHETYPE
Creates a maven project that is suitable for installing
resources for a simple CQ application. The folder structure is that used below
the /apps folder of the CQ repository. The POM defines commands for packaging
the resources that you place in the folders and installing the packages on the
CQ server.
Archetype artifact
properties:
·
Group ID: com.day.jcr.vault
·
Artifact ID: simple-content-package-archetype
·
Version: 1.0.2
·
Repository: adobe-public-releases
Maven command:
mvn
archetype:generate -DarchetypeGroupId=com.day.jcr.vault \
-DarchetypeArtifactId=simple-content-package-archetype
\
-DarchetypeVersion=1.0.2
\
-DarchetypeRepository=adobe-public-releases
·
groupId: The groupId of the content package that
Maven generates. The value is autoatically used in the POM file.
- artifactId: The name of
the content package. The value is also used as the name of the project
folder.
- version: The version of
the content package.
- package: This value is
not used for simple-content-package-archetype.
- appsFolderName: The name
of the folder below /apps.
- artifactName: The
description of the content package.
- packageGroup: The name
of the content package group. This value configures the group parameter
for the Package goal of the Content Package Maven Plugin.
Folder structure:
|- pom.xml
|- README.txt
|- src
|- main
|-
content
|-
jcr_root
|-
apps
|-
${appsFolderName}
|-
components
|-
.content.xml
|-
config
|-
install
|-
META-INF
|-
vault
|-
config.xml
|-
filter.xml
|-
nodetypes.cnd
|-
properties.xml
|-
definition
|-
.content.xml
|
SIMPLE-CONTENT-PACKAGE-WITH-EMBEDDED-ARCHETYPE
Performs the same tasks as the simple-content-package-archetype, and also downloads and includes an artifact from a public Maven repository.
Archetype bundle properties:
·
Group ID: com.day.jcr.vault
·
Artifact ID: simple-content-package-with-embedded-archetype
·
Version: 1.0.2
·
Repository: adobe-public-releases
Maven command:
mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault
\
-DarchetypeArtifactId=simple-content-package-with-embedded-archetype
\
-DarchetypeVersion=1.0.2 \
-DarchetypeRepository=adobe-public-releases
Archetype parameters:
·
groupId: The groupId of the content package that
Maven generates. The value is autoatically used in the POM file.
·
artifactId: The name of the content package. The
value is also used as the name of the project folder.
·
version: The version of the content package.
·
package: This parameter is not used.
·
appsFolderName: The name of the folder below
/apps.
·
artifactName: The description of the content
package.
·
embeddedArtifactId: The ID of the artifact to
embed in the content package.
·
embeddedGroupId: The group ID of the artifact to
embed.
·
embeddedVersion: The version of the artifact to
embed.
·
packageGroup: The name of the content
package group. This value configures the group parameter for the
Package goal of the Content Package Maven Plugin.
Folder structure:
|- pom.xml
|- README.txt
|- src
|- main
|-
content
|-
jcr_root
|-
apps
|-
${appsFolderName}
|-
components
|-
config
|-
install
|-
META-INF
|-
vault
|-
config.xml
|-
filter.xml
|-
nodetypes.cnd
|-
properties.xml
|-
definition
|
Archetype - multimodule-content-package-archetype
(AEM 5.6.1)
- Create the initial structure from
Adobe's multimodule-content-package-archetype
In your
shell, go to a directory where your project is supposed to be created.
In
the following example, line breaks are only to make reading simpler. Everything
goes on one line.
$ 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=my-group-id \
-DartifactId=myproject
\
-Dversion=1.0-SNAPSHOT
\
-Dpackage=com.mycompany.myproject
\
-DappsFolderName=myproject
\
-DartifactName="My
Project" \
-DcqVersion="5.6.1" \
-DpackageGroup="My
Company"
|
- Confirm the provided values by entering "Y"
and hitting Return when Maven asks.
Confirm properties configuration:
groupId: my-group-id
artifactId: myproject
version: 1.0-SNAPSHOT
package: com.mycompany.myproject
appsFolderName: myproject
artifactName: My Project
cqVersion: 5.6.1
packageGroup: My Company
Y: :
|
- Maven has created a directory for the project. Change
into it:
# cd
myproject
- Now build the project and install it into your AEM instance. [don’t execute this step before
configuring public repo – see next step.]
# mvn
–PautoInstallPackage clean install
As a result the following
hierarchy is used for the project files:
- myproject - root folder
- content - project
folder holding UI resources
- bundle - project folder
containing the OSGI services
- pom.xml - the Maven
reactor and parent project file
Archetype 10 - com.adobe.granite.archetypes(AEM
6.1)
Requirements
- Adobe Experience Manager 6 or
higher
- Apache Maven (3.x should do)
Using CMD – Recommended
Equivalent Maven Command to Create a project based on
Archetype 10:
mvn
archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes
-DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=10
-DarchetypeRepository=adobe-public-releases
Now build the project and
install it into your AEM instance. [don’t
execute this step before configuring public repo – see next step.]
# mvn
clean install -PautoInstallPackage
Using AEM plugin
No comments:
Post a Comment