java - 为什么 Jenkins 不下载我的最新快照?

标签 java maven jenkins

我有一个 Maven 3 项目的 Jenkins 构建作业。该项目具有 SNAPSHOT 依赖项。构建失败,因为 Maven 找不到部署到 Intranet Sonatype Nexus Repository 的 SNAPSHOT Artifact 。 SNAPSHOT 存储库是“public”组的一部分,它是 <mirrorOf>*</mirrorOf> 的镜像 URL。 .
Jenkins 配置为在工作区本地创建一个本地 Maven 存储库(每个作业一个存储库)。
所有其他非快照依赖项都已解决并下载良好。没有 SNAPSHOT 依赖项的项目的其他作业也已成功构建。 到目前为止我尝试过的事情(没有成功):

  • Nexus 缓存过期
  • 检查了本地存储库(在作业目录中)- 没有 Artifact 目录
  • 在作业配置中将“Build -> Goals and options”设置为“-U clean install”
  • 等一小时

我的设置:
Windows 服务器 2003
Java 1.6.0_31
Jenkins 1.480
maven 3.0.3

最佳答案

这可能是我也发现的“陷阱”,从 Nexus 下载快照修订版。

Nexus book 中提供了解决方案,但没有完全解释:

<settings>
  <mirrors>
    <mirror>
      <id>nexus</id>
      <url>http://myserver/nexus/content/groups/public</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

似乎必须明确告诉 Maven Nexus 提供的存储库组也可以包含快照修订。据推测,这样做会触发 Maven 开始寻找特殊的元数据文件,这些文件用于发现哪个带时间戳的文件实际上是最新的快照。

关于java - 为什么 Jenkins 不下载我的最新快照?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12302457/

相关文章:

java - 使用 Maven 覆盖进行热部署

java - Maven 编译无提示地失败 - Unresolved 编译问题

java - 配置 Manuel 容器 IntelliJ Arquillian Wildfly

performance - 更改后无法保存 Jenkins Job,没有错误可见

jenkins - Jenkins Openshift 管道脚本中出现有关无法读取证书颁发机构的错误

git - Jenkins:运行构建不提供 docker slave

Java self 反射(reflection)

java - @JsonApiRelationId 和 @JsonApiRelation 有什么区别?

java - 忽略 Servlet loadOnStartup

java - 随着数组值的变化,将数组的值存储在单独的文件中