【问题标题】:Apache Ivy: How to have timestamp appended to artifacts while publishingApache Ivy:如何在发布时将时间戳附加到工件
【发布时间】:2015-11-08 10:39:03
【问题描述】:

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

有没有办法给这个名字加上时间戳?

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

但我的发布蚂蚁任务如下,将其发布为 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 更改工件的名称?有什么帮助吗?

【问题讨论】:

    标签: publish ivy


    【解决方案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" />
    

    【讨论】:

      【解决方案2】:

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

      这里解释:

      相关答案:

      【讨论】:

        猜你喜欢
        • 2012-02-29
        • 2019-01-28
        • 2018-07-23
        • 1970-01-01
        • 2011-01-31
        • 1970-01-01
        • 2011-01-10
        • 2010-11-16
        • 1970-01-01
        相关资源
        最近更新 更多