为什么 Artifactory 无法下载请求的工件?
我们将一个具有 [filename] 名称的工件部署到 Artifactory,该工件获得 Artifactory 为其应用的时间戳。随后,在不同的主干中,其构建尝试使用先前部署的相同名称来下载该工件。但是,由于 Artifactory 应用于文件名的时间戳,后续构建会失败并出现“无法从任何存储库下载工件”错误。除了关闭 Artifactory 时间戳之外,还有其他解决方案吗?我们相信 Artifactory 足够聪明,至少知道在请求时返回最新的带有时间戳的工件。
We deploy to Artifactory an artifact that has a [filename] name that gets a time stamp applied to it by Artifactory. Later in a different trunk, its build attempts to download that artifact using the same name under which it got deployed earlier. However, because of the time stamp that Artifactory applied to the file name, this subsequent build fails with a "Unable to download the artifact from any repository" error. Other than turning of Artifactory time stamping, is there a solution to this problem? Our belief was that Artifactory would be smart enough to know at least to return the latest time stamped artifact when requested.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常这将是一条评论,但由于我缺乏这方面的代表,我这样做作为答案:
Artifactory 肯定能够处理这个问题。为什么您认为时间戳是问题所在?这对于快照来说是正常的,并且 maven-metadata.xml 应该指示哪个是最后一个版本。
您是否为工件使用版本范围?
我的理解是否正确:您所描述的在其(自己的)构建中部署到 Artifactory 的工件想要使用自身?你能发布你的 POM 的相关部分吗?
Normally this would be a comment but since I'm lacking the rep for this I do this as answer:
For sure Artifactory should be able to handle this. Why do you think the timestamp is the problem? This is normal for snapshots and f.e. the maven-metadata.xml should indicate which is the last version.
Do you use a version range for the artifact?
Do I get you right: The artifact that you describe to be deployed to Artifactory in its (own) build wants to use itself? Could you post relevant parts of your POM?
最近,在将存储库配置从存储非唯一快照更改为唯一快照后,我遇到了类似的问题。 (参见此处)
当存在相同版本的工件,下载时会出现问题。
例如,在存储库中,如果文件夹
/com/mycompany/test/foo/1.0.0-SNAPSHOT/
下有foo-1.0.0-SNAPSHOT.pom
和foo-1.0.0-20130329-231102-1.pom
,然后下载 com.mycompany.test:foo:1.0.0-SNAPSHOT:pom 会出错。您必须删除名称中带有 SNAPSHOT 的文件或名称中带有时间戳的所有文件。就我而言,我的存储库从存储非唯一快照切换为唯一快照,因此我应该删除 *-SNAPSHOT 文件。我编写了一个 Ruby 脚本来扫描所有最近部署的工件,并尝试删除相同版本的非唯一快照 (-SNAPSHOT) 文件(如果有)。它使用 Artifactory 的 REST API。这是来源:https://gist.github.com/aleung/5260512
I got similar issue recently after I changed repository configuration from storing non-unique snapshots to unique snapshots. (See here)
When both unique snapshot and non-unique snapshot of the same version of an artifact exists, there will be problem to download it.
For example, in a repository if under folder
/com/mycompany/test/foo/1.0.0-SNAPSHOT/
there arefoo-1.0.0-SNAPSHOT.pom
andfoo-1.0.0-20130329-231102-1.pom
, then downloading com.mycompany.test:foo:1.0.0-SNAPSHOT:pom will get error. You have to delete either the file with SNAPSHOT in name or all the files with time stamp in name.For my case, my repository switched from storing non-unique snapshots to unique snapshots, so I should delete the *-SNAPSHOT files. I wrote a Ruby script to scan all recent deployed artifacts and try to delete the same version non-unique snapshot (-SNAPSHOT) file if any. It uses Artifactory's REST API. Here is the source: https://gist.github.com/aleung/5260512