[英]Changing maven snapshot timestamp
When deploying a snapshot file to a maven repository, I want to be able to control the timestamp that is being used in the resulting file name, right now I see something like this show up: 将快照文件部署到Maven存储库时,我希望能够控制结果文件名中使用的时间戳,现在我看到这样的显示:
/snapshots/com/exampleinc/example/0.0.0-SNAPSHOT/example-0.0.0-20190224.230223-37.jar
I want to be able to set 20190224.230223
when running mvn deploy
. 我希望能够在运行
mvn deploy
时设置20190224.230223
。
I tried setting maven.build.timestamp
however it had no effect on it. 我试过设置
maven.build.timestamp
但是对它没有影响。
I can't find any documentation on how to do this, and I am not sure about which bit of code is actually controlling this so can't just dig through it. 我找不到有关如何执行此操作的任何文档,并且我不确定实际上是哪段代码控制了此操作,因此不能一探究竟。
The reason behind wanting to set this value is I want that timestamp embedded in the manifest file so that we can read it within the java process & associate it back to the original file without needing to read each jar (as there could be hundreds of builds for the same snapshot version) 想要设置此值的原因是我希望将时间戳嵌入清单文件中,以便我们可以在java进程中读取它并将其关联回原始文件,而无需读取每个jar(因为可能有数百个构建对于相同的快照版本)
We write a "build number" to a properties file in the jar (MANIFEST.MF would work as well) which represents the last part of the created jar name ( 37
in your case). 我们在jar中的属性文件中写入一个“内部版本号”(MANIFEST.MF也可以),它代表创建的jar名称的最后一部分(在您的情况下为
37
)。
With this information, it is possible to uniquely identify the jar, eg by questioning Nexus for the list of all timestamps for a given SNAPSHOT and extract the correct one. 有了这些信息,就有可能唯一地识别罐子,例如,通过向Nexus询问给定SNAPSHOT的所有时间戳列表并提取正确的罐子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.