How to create AEM project by maven archetype | Community
Skip to main content
Level 4
March 22, 2023
Solved

How to create AEM project by maven archetype

  • March 22, 2023
  • 5 replies
  • 6065 views

Hi Team, 

I am trying to learn aem concepts by my own. For that I am trying to create a project using the archetype commands, some commands throwing error and I couldn't create project.

If I able to create project then I can't build that project using mvn clean install -PautoInstallPackage this also throws error like not able to find pom.xml 

 

can you please share a exact achetype command and with version so I can start building project. 

Note: my AEM version is 6.5.0

 

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sady_Rifat

For your SP 6.5.0 version you can follow this link:

Archetype Historical Support: https://github.com/adobe/aem-project-archetype/blob/master/VERSIONS.md
AEM Project Archetype Details: https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
As my understanding maybe you are choosing the wrong archetype version.

You can try with the following command

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \ -D archetypeGroupId=com.adobe.aem \ -D archetypeArtifactId=aem-project-archetype \ -D archetypeVersion=20 \ -D appTitle="My Project" \ -D appId="my-project" \ -D groupId="com.my.project" \ -D artifactId="my-project" \ -D package="com.my.project" \ -D version="0.0.1-SNAPSHOT" \ -D aemVersion="6.5.0"

5 replies

Sady_Rifat
Community Advisor
Sady_RifatCommunity AdvisorAccepted solution
Community Advisor
March 22, 2023

For your SP 6.5.0 version you can follow this link:

Archetype Historical Support: https://github.com/adobe/aem-project-archetype/blob/master/VERSIONS.md
AEM Project Archetype Details: https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
As my understanding maybe you are choosing the wrong archetype version.

You can try with the following command

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \ -D archetypeGroupId=com.adobe.aem \ -D archetypeArtifactId=aem-project-archetype \ -D archetypeVersion=20 \ -D appTitle="My Project" \ -D appId="my-project" \ -D groupId="com.my.project" \ -D artifactId="my-project" \ -D package="com.my.project" \ -D version="0.0.1-SNAPSHOT" \ -D aemVersion="6.5.0"
Himanshu_Jain
Community Advisor
Community Advisor
March 22, 2023
Himanshu Jain
somen-sarkar
Community Advisor
Community Advisor
March 22, 2023

Hi,

Below is a sample  command . You can run the same from a command promt with admin level previleges :-

 

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=41 -D appTitle="My Site" -D appId="mysite" -D groupId="com.mysite" -D includeExamples=n -D includeErrorHandler=y

 

Thanks,

Somen

Jagadeesh_Prakash
Community Advisor
Community Advisor
March 22, 2023

@tessa_learner1 

The error that you mentioned "this also throws error like not able to find pom.xml " will occurred commonly when your project is not a maven project. Ideally from the place where you are running mvn -PautoInstallPackage clean install should have a pom.xml file available in that location. 

Look if your project have proper pom.xml file and corresponding modules 

If you want to create a new module use below command 

 

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \ -D archetypeGroupId=com.adobe.aem \ -D archetypeArtifactId=aem-project-archetype \ -D archetypeVersion=cloud \ -D appTitle="My Site" \ -D appId="mysite" \ -D groupId="com.mysite" \
December 26, 2023

//If I able to create project then I can't build that project using mvn clean install -PautoInstallPackage this also throws error like not able to find pom.xml 

I think you could have forget to traverse to the root folder before run the "mvn clean install" command.

  • Lets say, you run maven project creation command in a folder called "maven-project".
  • Then you can see a new folder created under "maven-project".
  • In command prompt, you need to run cd "<new-folder>" command. Then run the "mvn clean install" command.