Today we will generate an AEM Project using a Maven archetype with the help of command line.
JDK should be installed
Maven should be installed
What is Maven Project?
Apache Maven is a software project management and comprehension tool. All Adobe Experience Manager Projects leverage Maven Project to generate, build, and deploy code.
What is Maven Archetype?
Archetype is a Maven project templating toolkit. AEM requires project code to be in particular structure. To generate this pre-created structure we use "aem-project-archetype" as an Archetype Id.
Paste the following into the command line to generate the project in batch mode and hit ENTER:
mvn -B archetype:generate \
-D archetypeGroupId=com.adobe.aem \
-D archetypeArtifactId=aem-project-archetype \
-D archetypeVersion=35 \
-D appTitle="WKND Sites Project" \
-D appId="wknd" \
-D groupId="com.adobe.aem.guides" \
-D artifactId="aem-guides-wknd" \
-D package="com.adobe.aem.guides.wknd" \
-D version="0.0.1-SNAPSHOT" \
Please refer following link to find about available parameters: https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html?lang=en#available-properties
This will create following project structure:
|--- ui.tests /
To Deploy the project to running AEM instance, execute following command at project repository folder(in this case at aem-guides-wknd)
mvn clean install -PautoInstallSinglePackage
The Maven profile "autoInstallSinglePackage" compiles the project and deploys as a single package to the AEM instance. By default the port is set to 4502 with the credentials of admin:admin. You can update it in parent pom.xml
If you receive following message it means the build was successful and project was deployed to the AEM instance.