从Artifactory下载元数据信息

时间:2014-05-19 09:31:57

标签: java maven maven-3 artifactory

在我工作的公司,我们正在使用像库存管理工具这样的工具。现在,我正在开发一个类似于以下内容的模块化项目:

enter image description here

现在,我意识到每天我第一次尝试通过命令构建我的应用程序

  

码头:运行

我收到以下信息:

    [INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/services/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/services/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/parent/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/parent/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/model/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/model/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/util/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/util/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/rest/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/test/0.0.1-SNAPSHOT/maven-metadata.xml

我认为这些xml文件是在本地存储库内的相应文件夹中的maven-metadata-repo.xml中转换的。例如,模型项目的文件maven-metadata-repo.xml包含以下信息:

        <?xml version="1.0" encoding="UTF-8"?>
    <metadata>
      <groupId>myCompany</groupId>
      <artifactId>model</artifactId>
      <version>0.0.1-20140417.095713-1</version>
      <versioning>
        <snapshot>
          <timestamp>20140417.095713</timestamp>
          <buildNumber>1</buildNumber>
        </snapshot>
        <lastUpdated>20140512073542</lastUpdated>
        <snapshotVersions>
          <snapshotVersion>
            <extension>pom</extension>
            <value>0.0.1-20140417.095713-1</value>
            <updated>20140417095713</updated>
          </snapshotVersion>
          <snapshotVersion>
            <extension>jar</extension>
            <value>0.0.1-20140417.095713-1</value>
            <updated>20140417095713</updated>
          </snapshotVersion>
        </snapshotVersions>
      </versioning>
    </metadata>

现在我想问你为什么我只在第一次(每天)下载运行命令jetty:run的下载信息? 此外,我以这种方式enter image description here

配置了神器库中的快照存储库

这是连续下载的原因吗?

1 个答案:

答案 0 :(得分:2)

这与Maven检查是否有更新的SNAPSHOT版本的依赖项(Maven3使用的是独特的SNAPSHOT版本)有关。 Maven下载maven-metadata.xml文件并检查它是否在本地Maven存储库中缓存了最新的SNAPSHOT版本,或者是否需要从Artifactory下载更新版本。 SNAPSHOTS的默认更新策略是每天检查一次(“每日”)。您可以在settings.xml文件中配置此策略,例如:

<repositories>
    <repository>
        <id>central</id>
        <url>my-server-url</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
        </releases>
    </repository>
</repositories>

可能的值为:“always”,“daily”(默认值),“interval:XXX”(以分钟为单位)或“never”(仅当本地不存在时)。