如何在 Maven 构建中添加 aem Uber jar 依赖项

How to add aem Uber jar dependency in maven build

我使用了如下所示的 maven archetype10 并创建了项目结构,一切都很好。

mvn archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=10 -DarchetypeRepository=https://repo.adobe.com/nexus/content/groups/public/

现在我想添加 aem uber-jar 依赖项,并分别在项目 pom.xml 和核心模块 pom.xml 中添加了以下依赖项标签,而且我的存储库标签与 https://repo.adobe.com/

       <dependency>
            <groupId>com.adobe.aem</groupId>
            <artifactId>uber-jar</artifactId>
            <version>6.2.0</version>
            <scope>provided</scope>
        </dependency>

在我编译时添加上面的依赖标记后出现以下错误。

[ERROR] Failed to execute goal on project aemexample.core: Could not resolve dependencies for project com.krishh.example:aemexample.core:bundle:0.1: Could not transfer artifact com.adobe.aem:uber-jar:jar:6.2.0 from/to adobe-public-releases (http://repo.adobe.com/nexus/content/groups/public): hostname in certificate didn't match: <repo.adobe.com> != <devedge.day.com> OR <devedge.day.com> -> [Help 1]

是否缺少任何东西来添加额外的依赖项来编译并且运行这成功了。

您的依赖项中似乎缺少分类器。尝试为 AEM API 添加一个,如 suggested in the documentation。这应该有助于 Maven 在存储库中找到必要的 JAR:

<dependency>
    <groupId>com.adobe.aem</groupId>
    <artifactId>uber-jar</artifactId>
    <version>6.2.0</version>
    <classifier>apis</classifier>
    <scope>provided</scope>
</dependency>

如果这没有帮助,您还应该查看证书警告。查看 this question 的答案以获取有关该主题的更多信息。

TL;DR - 可能的原因可能是:

  • 使用 HTTP 库的旧 Maven 版本与存储库使用的证书不兼容 - 尝试升级 Maven
  • 服务器使用了错误的证书
  • 您与存储库之间的潜在网络配置问题
  • 伪装成 Nexus 的一方试图让您下载恶意文件的实际尝试