【问题标题】:Prefetch maven-metadata.xml with nexus使用 nexus 预取 maven-metadata.xml
【发布时间】:2014-06-04 06:24:54
【问题描述】:

用maven3配置文件settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings>
  <!--<host>webproxy</host>-->
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://richter-local.de:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
    <servers>
        <server>
            <id>nexus</id>
        </server>
    </servers>
  <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>
            <updatePolicy>interval:10080</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>interval:10080</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>interval:10080</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>interval:10080</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
  <interactiveMode>true</interactiveMode>
  <usePluginRegistry>false</usePluginRegistry>
  <offline>false</offline>
</settings>

和一个 nexus maven 代理(版本 2.7.2-03)我必须在每天上午 00:00 之后等待一堆非常缓慢的 maven-metadata.xml 文件下载(大约需要 5 分钟的时间来获取一些 KB,这应该在几秒钟内传输)。如何预取这些文件以便将它们下载到我的本地 nexus 实例?

【问题讨论】:

  • 您的构建是否需要大量快照依赖项?
  • 我正在获取一些快照(50 个依赖项中的 2 个),我也想处理它们,即预取跳过缓慢下载所需的数据。

标签: maven maven-3 nexus maven-metadata


【解决方案1】:

听起来您有一个或多个代理存储库,它们的远程响应非常缓慢。这些缓存超时一天一次,导致检索非常缓慢。

有关如何调试此问题以及配置 Nexus 以防止问题再次发生的信息,请参见此处:

https://support.sonatype.com/entries/25884097-Troubleshooting-slow-maven-metadata-xml-download-speeds

【讨论】:

  • 在对设置“元数据最大年龄”和“未找到缓存 ttl”进行了一些实验后,我猜想将它们设置为更高值的解决方案不会解决我的问题,因为没有发生预取(它不会不管问题是一天发生两次还是一周发生一次)。我希望代理(即 nexus)能够预期缓慢的操作,并在请求时及时执行。
猜你喜欢
  • 1970-01-01
  • 2011-06-20
  • 2015-03-20
  • 1970-01-01
  • 2011-09-18
  • 2019-01-21
  • 2021-12-21
  • 2017-01-11
  • 2022-12-22
相关资源
最近更新 更多