What I would do is to conditionally execute the publish with an
unless="nopublish_because_uptodate" in your ant script.

I guess you could set 'nopublish_because_uptodate' by comparing the jar of
the repository with the one you just build.

Or it maybe just using an 'uptodate' before you compile might be enough if
you still want to republish after a local clean, but not when you rebuild
consecutively.


Gilles



> -----Original Message-----
> From: Bagwell, Allen F [mailto:[EMAIL PROTECTED]
> Sent: mardi 17 avril 2007 15:43
> To: [email protected]
> Subject: checking before publishing
> 
> Hi, I'm an Ivy newbie so please bear with me.  I've done the tutorials up
> through "multi-project".
> 
> I've been successful at getting Ivy to publish a library to a shared
> repository on our system.  But following the tutorial, it creates a new
> version every single time when the publish target is run. I'd like to be
> able to get Ivy to recognize that an artifact doesn't need to be published
> if it is that same as the last revision.  I've been struggling with trying
> to figure that out.
> 
> Here's what I have so far:
> 
> (in the config dir)
> 
> <ivysettings>
>       <settings defaultResolver="my-artifacts" />
>       <resolvers>
>               <filesystem name="my-artifacts" checkmodified="true" >
>                       <ivy
> pattern="${repos.root}/[organisation]/[module]/ivys/ivy-[revision].xml" />
>                       <artifact
> pattern="${repos.root}/[organisation]/[module]/[type]/[revision]/[artifact
> ].[ext]" />
>               </filesystem>
>       </resolvers>
>       <modules>
>               <module organisation="myorg" name="math_lib" resolver="my-
> artifacts" />
>       </modules>
> </ivysettings>
> ----------------------------------------
> (in ivy.xml)
> 
> <ivy-module version="1.3">
> 
>     <info organisation="myorg" module="math_lib" status="integration" />
> 
>     <configurations defaultconfmapping="default">
>               <conf name="master" description="the compiled artifact" />
>               <conf name="default" extends="master" />
>     </configurations>
> 
>     <publications>
>       <artifact name="libMath" type="static" ext="a" conf="*" />
>     </publications>
> 
> </ivy-module>
> 
> --------------------------------------------
> (in the ant build.xml file)
> 
>       <!-- =================================
>             target: publish (ivy)
>           ================================= -->
>       <target name="publish" depends="resolve,build" description="-->
> publish this project in the ivy repository">
>               <delete file="${cpp.dir.src}/ivy.xml" />
>               <ivy:buildnumber organisation="myorg" module="math_lib"
> revision="3.5.0"/>
>               <property name="revision" value="${ivy.new.revision}"/>
>               <ivy:publish
> artifactspattern="${cpp.dir.src}/[artifact].[ext]"
>                               resolver="nap-artifacts"
>                               pubrevision="${revision}" />
>               <echo message="project ${ant.project.name} released with
> version ${revision}" />
>       </target>
> 
>     <!-- =================================
>           target: resolve
>          ================================= -->
>     <target name="resolve" description="--> retreive dependencies with
> ivy">
>               <ivy:configure file="config/ivysettings.xml" />
>         <ivy:resolve />
>     </target>
> 
> This set up does the following whenever publish is run:
> 
> /ivyrep/myorg/math_lib/static/3.5.0.0/libMath.a
> /ivyrep/myorg/math_lib/static/3.5.0.1/libMath.a
> /ivyrep/myorg/math_lib/static/3.5.0.2/libMath.a
> /ivyrep/myorg/math_lib/static/3.5.0.3/libMath.a
> 
> Where libMath.a ends up being the same executable in the ivy repos
> (confirmed by looking at value of each libMath.a.md5).  How can I get it
> so that a new revision is produced only if the .a file is different?
> 
> Any help is greatly appreciated.
> -Allen Bagwell

Reply via email to