简体   繁体   English

更改Maven快照时间戳

[英]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(因为可能有数百个构建对于相同的快照版本)

Build timestamp can be customized by declaring the property maven.build.timestamp.format , you can find the documentation here 可以通过声明属性maven.build.timestamp.format来定制构建timestamp ,您可以在此处找到文档

<properties>
  <maven.build.timestamp.format>yyyyMMdd-HHmmss</maven.build.timestamp.format>
</properties>

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.

相关问题 检索Maven Snapshot的时间戳 - Retrieving Maven Snapshot's timestamp maven命令行下载带时间戳的最新快照 - maven command line to download latest snapshot with timestamp maven:在给定时间戳之前使用快照版本 - maven: using snapshot version before given timestamp MAVEN部署快照软件包用时间戳替换路径中的SNAPSHOT,而不是软件包名称 - MAVEN deploy snapshot package replace the SNAPSHOT in path, not package name, with timestamp 为什么 Maven 无法从 Azure 工件存储库下载“SNAPSHOT”工件? (快照到时间戳的转换出现故障) - Why maven is not able to download "SNAPSHOT" artifacts from azure artifacts repository? (Snapshot translation to timestamp is malfunctioning) 快照 jar 的 maven-metadata.xml 中的时间戳比实际 jar 的时间戳多一秒? - The timestamp in snapshot jar's maven-metadata.xml is more than a second than the actual jar's timestamp? 如何使用 maven 从 nexus 检索快照的时间戳和内部版本号? - How to retrieve snapshot's timestamp & build number from nexus using maven? 为什么Maven Versions Plugin(版本:use-latest-versions)没有更新/更改-SNAPSHOT版本才能发布(无-SNAPSHOT版本)? - Why Maven Versions Plugin (versions:use-latest-versions) not updating/changing -SNAPSHOT version to release (none -SNAPSHOT version)? Maven-发布快照依赖项 - Maven - release snapshot dependencies 有没有办法取消部署Maven快照? - Is there a way to undeploy a maven snapshot?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM