简体   繁体   English

从sbt发布时设置build.timestamp

[英]Setting build.timestamp when publishing from sbt

Today, my team has a handful of projects which are frequently 'published' for production usage. 今天,我的团队有一些项目经常被“发布”用于生产用途。 We are using JFrog's hosted Artifactory solution to host our binaries, but are running into a problem when project publish both jars and assembly files. 我们正在使用JFrog的托管Artifactory解决方案来托管我们的二进制文件,但是在项目同时发布jar和程序集文件时遇到了问题。

From speaking to someone at JFrog, they said the following. 通过与JFrog的某人交谈,他们说了以下话。

Artifactory expects the deployment to be in the following order (as done by Maven): Artifactory期望按以下顺序进行部署(由Maven完成):

  1. jar
  2. pom POM
  3. classifiers 分类器

I suspect that since you are deploying the files on a different order, Artifactory fails to calculate the unique snapshot. 我怀疑由于您以不同的顺序部署文件,因此Artifactory无法计算唯一快照。
However, there is a way to make it work: 但是,有一种方法可以使其起作用:

For each artifact add the 'build.timestamp' HTTP matrix param with the current time in milliseconds. 为每个工件添加“ build.timestamp” HTTP矩阵参数以及当前时间(以毫秒为单位)。 Note that all of the artifacts from the same build should have the same timestamp value. 注意,来自同一构建的所有工件都应具有相同的时间戳记值。

For example: 例如:
http://myaccount.artifactoryonline.com/myaccunt/libs-snapshots-local/com/artifact-SNAPSHOT.jar;build.timestamp=1375140480339 http://myaccount.artifactoryonline.com/myaccunt/libs-snapshots-local/com/artifact-SNAPSHOT.jar;build.timestamp=1375140480339

Two questions out of this: is SBT really publishing in a different order and if so how do I change the publish url to include this build.timestamp? 这有两个问题:SBT真的以不同的顺序发布吗?如果是,我如何更改发布URL以包括此build.timestamp?

sbt doesn't publish in a defined order. sbt不会按定义的顺序发布。 I don't think there is a way to put a timesamp in the published URL, so the best option is to implement an order in sbt itself. 我认为没有办法在已发布的U​​RL中添加时间戳,因此最好的选择是在sbt本身中实现订单。

Previous discussion: https://groups.google.com/d/topic/simple-build-tool/FZqTfpizI-k/discussion The link there is now at: https://github.com/sbt/sbt/blob/0.13/ivy/src/main/scala/sbt/IvyActions.scala#L257 先前的讨论: https : //groups.google.com/d/topic/simple-build-tool/FZqTfpizI-k/discussion该链接现在位于: https : //github.com/sbt/sbt/blob/0.13 /ivy/src/main/scala/sbt/IvyActions.scala#L257

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM