zharvey wrote on 09/15/2011 09:20 AM:

Alan,

Wow - thanks for such a thorough answer! I'm still not seeing the blatent
connection between the publications tag and my ivy:publish task though.  Say
I change my ivy.xml:

<publications defaultconf="publish">
     <artifact name="MyModule"/>
</publications>

If you're just going to stick with the default of having the artifact have the same name as the ivy module, you don't even need to list the artifact up there, though it can help clear up any ambiguity for someone reading your ivy.xml.

This just tells Ivy that I've got something to publish called MyModule.  But
where do I tell Ivy that MyModule is actually located at
workspace\MyProject\dist\MyModule-1.0.jar and that I want to publish it to
my pubRepo repository when I run ivy:publish? I know what you're saying is
correct, I'm just having trouble connecting all the dots.

In a publish task, the artifactspattern attribute describes the location of the file to be published on disk; the resolver attribute describes which resolver to publish to (a filesystem resolver or sftp, for example), and then you generally want a pubrevision and status as well.

As an example, here's my default ant target for publishing:


   <target name="publish_only"
            depends="resolve"
description="--&gt; publish this project in the prod ivy repository">
        <property name="revision" value="${version}" />
<ivy:publish artifactspattern="${dist.dir}/[type]s/[artifact]-[revision].[ext]"
                     resolver="masrep_sftp"
                     pubrevision="${revision}"
                     status="release"
                     overwrite="true"
                     update="true" />
<echo message="project ${ant.project.name} released with version ${revision}" />
    </target>

Thanks,
---
Kirby Files
Software Architect
Masergy Communications
kfi...@masergy.com

Reply via email to