【问题标题】:Maven dependencies in local REPO have .lastUpdated extension本地 REPO 中的 Maven 依赖项具有 .lastUpdated 扩展名
【发布时间】:2013-05-27 06:15:02
【问题描述】:

当我尝试在本地存储库中安装 maven 项目时,我注意到 pomjar 文件具有 .lastUpdated 扩展名。由于这个问题,我无法构建依赖它的项目。

您能解释一下为什么会这样吗?

【问题讨论】:

    标签: maven


    【解决方案1】:

    我找到了答案here

    当无法下载工件时,Maven 3 会将此结果缓存在“~/.m2/repo/.../.lastUpdated”文件中以供将来参考。对于“未找到”的情况,似乎可以使用 HTTP 代码更精细地重新尝试检索,而不仅仅是缓存故障。 例如,对于任何 404,我同意,结果应该缓存失败并要求 -U 尝试再次检索它。但是,对于 400、500、501、502、503、301、302(今天 3xx 的 Maven 行为是什么?)我认为解析引擎应该尝试每次重新检索工件。使用这些错误代码,似乎更可能是配置问题或短暂的网络故障,而不是该存储库中缺少文件之一。但是,这种短暂的网络中断具有长期缓存影响,因为该文件永远不会被再次尝试检索。

    【讨论】:

      【解决方案2】:

      当您引用 Maven 存储库下列出但实际不存在的工件时,也会发生这种情况。例如,以下 Exasol artifact 列在 Maven 存储库下,但有一个小注释说明:

      注意:此工件位于 Exasol 存储库中 (https://maven.exasol.com/artifactory/exasol-releases/)

      这意味着您需要在pom.xml 文件中单独添加另一个存储库(在本例中为 Exasol)作为源:

      <!-- add the dependency as mentioned in maven website -->
      <dependencies>
          <dependency>
              <groupId>com.exasol</groupId>
              <artifactId>exasol-jdbc</artifactId>
              <version>6.2.1</version>
          </dependency>
      </dependencies>
      
      <!-- add the actual repository which unfortunately isn't mentioned in maven website -->
      <repositories>
          <repository>
              <id>maven.exasol.com</id>
              <url>https://maven.exasol.com/artifactory/exasol-releases</url>
              <snapshots>
                  <enabled>false</enabled>
              </snapshots>
          </repository>
      </repositories>
      

      【讨论】:

        猜你喜欢
        • 2011-02-01
        • 2018-02-22
        • 2012-09-22
        • 2016-12-25
        • 1970-01-01
        • 2014-06-18
        • 1970-01-01
        • 2016-09-30
        相关资源
        最近更新 更多