ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burt Leung <burt.le...@gmail.com>
Subject Re: Question about publishing snapshots to nexus
Date Mon, 21 Dec 2009 23:46:52 GMT
Thank you very much for your help Maarten!

I was successful at using the ivy:deliver task to generate an ivy.xml file
with the specifications that I required. Here is an excerpt of my (revised)
task for publishing snapshots to the Nexus repository:
=====================================
<target name="publishSnapshot">
    <available property="isArtifactsDirCorrect" file="${artifactsDir}"/>
    <fail message="The directory is not valid: ${artifactsDir}"
          unless="isArtifactsDirCorrect" />

    <!-- since we are publishing a snapshot, the ivy.xml file needs to have
a
         special revision value that is postfixed with "-SNAPSHOT"
         (a Maven convention). we use the IVY deliver task to create a
special
         copy of the ivy.xml file with the snapshot revision value. -->
    <property name="generatedIVYFile" value="${artifactsDir}/ivy.xml"/>
    <ivy:deliver deliverpattern="${generatedIVYFile}"
        settingsref="defaultSettings"
        organisation="${ivyOrg}" module="${ivyModule}" status="integration"
        revision="${ivyModuleVersion}"
        pubrevision="${ivyModuleVersion}-SNAPSHOT" />

    <!-- must do an IVY "resolve" operation on the generated IVY file. this
is
         because it creates a special file named
"resolved-[org]-[revision].xml"
         in the local IVY cache. this file is checked for by the IVY
framework
         before it proceeds and fails if it does not find the file. -->
    <property name="resolveIVYFile" value="${generatedIVYFile}"/>
    <antcall target="resolveInternal"/>

    <!-- generate the Maven POM file that will be uploaded to the
         repository. -->
    <ivy:makepom ivyfile="${generatedIVYFile}"
        pomfile="${artifactsDir}/${ivyModule}.pom"/>

    <ivy:publish resolver="SnapshotsRepo" settingsref="defaultSettings"
        organisation="${ivyOrg}" module="${ivyModule}"
        revision="${ivyModuleVersion}-SNAPSHOT" pubdate="now"
        overwrite="true" artifactspattern="${artifactsDir}/[artifact].[ext]"

        publishivy="false" status="integration">
        <!-- need to specify that the pom file will be published too. -->
        <artifact name="${ivyModule}" type="pom" ext="pom"/>
    </ivy:publish>
</target>
=====================================


As you suggested, I created a new Jira (improvement) issue for implementing
timestamped snapshots. This new Jira issue is at
https://issues.apache.org/jira/browse/IVY-1153




On Wed, Dec 16, 2009 at 1:22 PM, Maarten Coene <maarten_coene@yahoo.com>wrote:

> To solve your problem of having to duplicate the ivy.xml, you might want to
> deliver your ivy.xml file first to a temporary location.
> With the ivy:deliver task, you can set the revision of the delivered
> ivy.xml file, and in addition, ivy:deliver can optionally replace all
> dynamic revisions with static ones. This can avoid problems because maven
> won't understand revisions like for instance "latest.integration".
>
> After that, you can use the ivy:makepom task to transform your delivered
> ivy.xml file into a pom file.
>
> Another approach could be that you specify the revision in your ivy.xml as
> an ant property? Ivy will replace such properties when parsing the ivy.xml
> file...
>
> I don't know how to solve your second problem though. I think Ivy can
> download these kind of timestamped snapshots, but it probably can't publish
> them this way. Maybe you could open a JIRA improvement request for this? Or
> maybe you can add those timestamped artifacts as extra <artifact> element to
> your ivy:publish task?
>
> Maarten
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message