Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to create AEM project by maven archetype

Avatar

Level 5

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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/archetyp...
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"

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

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/archetyp...
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"

Avatar

Level 5

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

Avatar

Community Advisor

@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" \

Avatar

Level 1

//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.