Maven 无法找到 AEM 原型

Maven Unable to Find AEM Archetype

我已经开始解决这个问题很久了...我正在处理 Adob​​e wknd 项目,但我无法通过这个命令,大部分工作都是基于它构建的

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

我在 VPN 上和关闭时都试过了,使用了所有可能的代理配置,但仍然出现

相同的错误
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)

多次删除并重新安装。不同的网络和代理配置 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"

得到这个错误

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)

构建失败,我现在不知道去哪里

该错误表明没有配置包含您要使用的原型的 Maven 存储库。默认的 Maven 安装不知道包含原型的 Adob​​e 存储库。您必须配置存储库。

通常,您应该为您的 AEM 项目使用以下存储库:

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

此存储库包含您要使用的原型:

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

根据文档(参见下面的链接),这将是一个最小的 Maven settings.xml,允许您使用 AEM Maven 原型:

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

注意:我将 adobe-public 配置文件的 activeByDefault 设置为 true。这样你就不需要在命令行上传递-Padobe-public来激活配置文件了。

现在,如果您 运行 以下命令,您应该能够使用原型:

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

链接:

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

在 Adob​​e 配置文件中缺少 'settings' xml 标签:

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

      .....

     </profile>
   </profiles>
</settings> 

只需更新 m2 文件夹中的 settings.xml 文件即可。如果您使用的是 archtype 13 和 6.4

,请查看下面的 link

https://helpx.adobe.com/experience-manager/using/maven_arch13.html

同样在个人资料标签中,请将 adobe 存储库 url 更新为 'https' 而不是 http。