gpt4 book ai didi

maven - Artifactory 不导入所有 Artifact

转载 作者:行者123 更新时间:2023-12-02 03:01:29 29 4
gpt4 key购买 nike

我负责在无法访问互联网的大型企业环境中安装 Artifactory 实例。所有 Maven 构建都必须从内部(内部网)Maven 存储库中获取依赖项。在 settings.xml 文件中添加了一个镜像,并将其设置为所有内容的默认镜像。

然后我设置了一台连接到 Internet 的独立计算机,以下载所有必要的依赖项(spring、struts2 等),这些依赖项被认可用于整个组织的不同项目。我使用 mvn archetype:generate 创建了一个虚拟 maven 项目,以便使用所有必要的东西填充我的本地存储库,以便 Maven 按预期工作。

安装 Artifactory 很顺利,特定依赖项(如 Spring 和 Struts2)的导入也很顺利。然而,运行 mvn archetype:generate 返回了一些这样的错误:

The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.4 is missing, no dependency information available.

因此,我意识到我也需要将 Maven 插件导入 Artifactory 实例,我做到了。事实上,我已经在独立计算机上压缩了整个 C:\Users\MYUSER.m2\repository 文件夹,将压缩包带到 Artifactory 服务器,然后使用 Artifactory 管理员帐户导入所有内容,使用 Admin > Import & Export >存储库 > 从 Zip 导入存储库。

Artifactory 说导入成功完成,但我仍然遇到同样的错误,提示缺少一些 Maven 插件。查看 Artifactory 中的 Artifact 页面,我发现它缺少一些 Maven 插件 Artifact 属于 zip 的一部分。 Artifactory 没有从我的 zip 文件导入所有内容。

org/apache/maven/plugins

  • maven-antrun-插件
  • maven-原型(prototype)插件
  • maven-assembly-plugin
  • maven-clean-plugin
  • maven-compiler-plugin
  • maven 依赖插件
  • maven-deploy-plugin
  • maven-install-plugin
  • maven 插件
  • maven-release-plugin
  • maven-resources-plugin
  • maven 网站插件
  • maven-surefire-plugin
  • maven-war-插件

在org/apache/maven/plugins下的Artifactory中导入

  • maven-clean-plugin
  • maven-compiler-plugin
  • maven 插件
  • maven-resources-plugin
  • maven-surefire-plugin
  • maven-war-插件

所以我的问题是,为什么 Artifactory 在不让我知道的情况下默默地忽略导入某些依赖项?

谢谢

更新

即使我从独立计算机的 org/apache/maven/plugins 下浏览 Maven 插件(Admin > Import & Export > Repositories > Import Repository from Path),Artifactory 也不会向我显示它们。它只会显示我上面列出的那些。

2017-08-23 更新

artifactory.log

2017-08-23 08:18:13,100 [art-exec-1] [INFO ] (o.a.r.d.i.DbRepoImportHandler:149) - repo-endorsed import started C:\dev\repository
2017-08-23 08:18:40,468 [art-exec-1] [INFO ] (o.a.r.d.i.ImportExportAccumulator:98) - repo-endorsed imported 1000 items (574 files 426 folders 36.58 ips) 0 skipped items (0 files 0 folders)...
2017-08-23 08:19:06,906 [art-exec-1] [INFO ] (o.a.r.d.i.ImportExportAccumulator:98) - repo-endorsed imported 2000 items (1129 files 871 folders 37.18 ips) 0 skipped items (0 files 0 folders)...
2017-08-23 08:19:15,829 [art-exec-1] [INFO ] (o.a.r.d.i.DbRepoImportHandler:199) - repo-endorsed import finished with: 2264 Items imported: (1262 files 1002 folders). Duration: 1.04 minutes IPS: 36.14 Target: 'C:\dev\repository'
2017-08-23 08:19:15,829 [art-exec-3] [INFO ] (o.a.r.s.ImportJob :127) - Import of 1 repositories completed

导入.导出.log

我看到了几条这样的消息,但 Artifact 正在按预期导入:

2017-08-23 08:18:36,655 [DEBUG] (o.a.a.c.ImportExportStatusHolder:43) No Metadata entries found for C:\dev\repository\org\apache\maven\plugins\maven-compiler-plugin\3.1\maven-compiler-plugin-3.1.jar

查看这些消息,我没有看到任何与缺失部分相关的信息,例如 maven-install-plugin。看起来 Artifactory 确实跳过了它。

最佳答案

感谢您添加附加信息。只是为了确保,当您要:

C:\dev\repository\org\apache\maven\plugins\maven-compiler-plugin\3.1

你能看到 maven-compiler-plugin-3.1.pom 文件吗?

如果 Artifactory 没有 pom 文件,它不会在文件夹级别生成 maven-metadata 文件,这意味着当您运行 maven 构建时,maven 客户端将不会得到它。

要解决此问题,如果这确实是缺少 POM,您可以通过 UI 手动将此 JAR 文件部署到该位置并使用“自动生成 POM”功能,该功能将为该 JAR 创建一个 POM 文件,结果是maven元数据计算。

关于maven - Artifactory 不导入所有 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45824194/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com