Search code examples
mavenaem

Maven Unable to Find AEM Archetype


I've been starting at this problem for way to long... Im working through the Adobe wknd project and I can't get pass this command and most of the work is built off of it

mvn archetype:generate \
  -DarchetypeGroupId=com.adobe.granite.archetypes \
  -DarchetypeArtifactId=aem-project-archetype \
  -DarchetypeVersion=18

I've tried it on the VPN and off, with all possible proxy configs and still getting the same error of

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.adobe.granite.archetypes:aem-project-archetype:18)

Deleting and reinstalling multiple times. Different networks and proxy configs as well Mac OS.

mvn -v returns

Maven home: /Users/dmills/Applications/apache-maven-3.6.1
Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"

Get this error

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.adobe.granite.archetypes:aem-project-archetype:18)

Build is failing and I don't know where to go now


Solution

  • The error indicates that there is no Maven repository configured that contains the archetype you want to use. Default Maven installations are not aware of the Adobe repository which contains the archetype. You have to configure the repository.

    Usually, you should use the following repository for your AEM projects:

    http://repo.adobe.com/nexus/content/groups/public
    

    This repository contains the archetype you want to use:

    https://repo.adobe.com/nexus/content/groups/public/com/adobe/granite/archetypes/aem-project-archetype/18/

    Based on the documentation (see Links below) this would be a minimal Maven settings.xml that would allow you to use the AEM Maven archetype:

    <settings 
      xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
      https://maven.apache.org/xsd/settings-1.0.0.xsd">
    
      <profiles>
        <profile>
          <id>adobe-public</id>
          <activation>
            <activeByDefault>true</activeByDefault>
          </activation>
          <properties>
            <releaseRepository-Id>adobe-public-releases</releaseRepository-Id>
            <releaseRepository-Name>Adobe Public Releases</releaseRepository-Name>
            <releaseRepository-URL>http://repo.adobe.com/nexus/content/groups/public</releaseRepository-URL>
          </properties>
          <repositories>
            <repository>
              <id>adobe-public-releases</id>
              <name>Adobe Basel Public Repository</name>
              <url>http://repo.adobe.com/nexus/content/groups/public</url>
              <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
              </releases>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
            </repository>
          </repositories>
          <pluginRepositories>
            <pluginRepository>
              <id>adobe-public-releases</id>
              <name>Adobe Basel Public Repository</name>
              <url>http://repo.adobe.com/nexus/content/groups/public</url>
              <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
              </releases>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
            </pluginRepository>
          </pluginRepositories>
        </profile>
      </profiles>
    </settings> 
    

    Note: I set activeByDefault to true for the adobe-public profile. This way you do not need to pass -Padobe-public on the command line to activate the profile.

    Now, if you run the following command you should be able to use the archetype:

    mvn archetype:generate \
      -DarchetypeGroupId=com.adobe.granite.archetypes \
      -DarchetypeArtifactId=aem-project-archetype \
      -DarchetypeVersion=18
    

    Links:

    https://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html