3

While publishing artifacts using ivy:publish ant task, artifacts name is appended with whatever we specify for revision/pubrevision attribute of ivy:publish task.

Is there a way to append timestamp as well to this name?

To elaborate a little further... I want to publish my artifact (For e.g. test.jar) to repository (may be public or shared) with version as DEV.SNAPSHOT but name of published JAR should be like test-DEV.SNAPSHOT.currentTimestamp.jar

But my publish ant task which is as follow is publishing it as 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>

Not understanding why ivy:publish changing the name of artifact? Any Help?

2 Answers2

1

In build.xml

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

In ivy.xml

  <info organisation="com.adme" module="foo" revision="1.0-${version.time}-SNAPSHOT" />
romsky
  • 864
  • 1
  • 8
  • 11
0

Publishing SNAPSHOT artifacts with timestamps is a Maven repository feature that ivy does not support.

Explained here:

Related answer:

Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185