Apache Ivy:如何在发布时为工件添加时间戳

3
使用 ivy:publish ant 任务发布构件时,构件名称会附加上我们为ivy:publish任务的revision/pubrevision属性指定的内容。
是否有一种方法可以将时间戳附加到此名称中?
稍作解释... 我希望将我的构件(例如test.jar)发布到存储库(可能是公共的或共享的),版本为DEV.SNAPSHOT,但发布的JAR名称应该像test-DEV.SNAPSHOT.currentTimestamp.jar这样。
但是我的发布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会更改构件的名称?能帮忙解释一下吗?

2个回答

1
在 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" />

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接