Apache Ivy:如何在发布时将时间戳附加到工件

Apache Ivy: How to have timestamp appended to artifacts while publishing

使用 ivy:publish ant 任务发布工件时,工件名称会附加我们为 revision/pubrevision 属性指定的内容ivy:publish 任务。

有没有办法将时间戳附加到这个名字?

再详细一点... 我想将我的工件(例如 test.jar)发布到版本为 DEV.SNAPSHOT 的存储库(可能是 public 或共享),但已发布的 JAR 的名称应该像 test-[=31= .currentTimestamp.jar

但是我的 publish ant 任务是将它发布为 test-DEV.SNAPSHOT.jar

<target name="publish-local" depends="jar">
    <tstamp>
        <format property="snapshot.timestamp" pattern="yyyyMMdd.HHmmss"/>
    </tstamp>
    <move file="${jar.file}" tofile="${build.dir}/${ant.project.name}-DEV.SNAPSHOT.${snapshot.timestamp}.jar"/>
    <ivy:deliver deliverpattern="${build.dir}/ivy-[revision].${snapshot.timestamp}.xml" pubrevision="DEV.SNAPSHOT" status="integration"/>
    <ivy:resolve/>
    <ivy:publish resolver="my-local" pubrevision="DEV.SNAPSHOT" status="integration" overwrite="true" publishivy="true">
        <ivy:artifacts pattern="${build.dir}/[artifact]-[revision].${snapshot.timestamp}.[ext]"/>
    </ivy:publish>
</target>

不明白为什么 ivy:publish 更改工件的名称?有帮助吗?

使用时间戳发布 SNAPSHOT 工件是 ivy 不支持的 Maven 存储库功能。

此处解释:

相关回答:

  • What's wrong with this Ivy changingPattern / SNAPSHOT configuration?

在build.xml

  <tstamp>
    <format property="version.time" pattern="yyyy-MM-dd-HH-mm-ss" />
  </tstamp>

在ivy.xml

  <info organisation="com.adme" module="foo" revision="1.0-${version.time}-SNAPSHOT" />