On 9/15/2011 5:58 AM, zharvey wrote:
(1) What is is the difference between the ivy:publish task called from the
ant buildscript, and the "publications" element defined in the ivy.xml file
("module descriptor")? According to the docs, the publications element is
used to "declare artifacts to be published", whereas the ivy:publish task
actually publishes artifacts. But how are these two connected?
Well, the way I see it, the publications element is a definition of what
you want published and the Ivy publish task
reads the definition and does what you ask.
Can they
conflict with one another?
Following my definition above, they can't "conflict with each other"
because they are two different aspects of the same concept.
If they are connected, what are the best
practices for making them work nicely with one another? For example, here's
what I have so far:
They are indeed connected because the ivy.xml publications element tells
the ivy:publish task what to do.
ivy.xml
=====
<publications defaultconf="publish">
<artifact name="[artifact]-[revision].[ext]"/>
</publications>
build.xml
======
<target name="publish">
<ivy:publish>
<artifacts pattern="dist/[artifact]-[revision].[ext]"/>
</ivy:publish>
</target>
Am I doing it right?!?
See
http://ant.apache.org/ivy/history/latest-milestone/ivyfile/artifact.html, specifically,
under 'Attributes'
name the name of the published artifact. This name must not include
revision.
The name of the artifact should be something meaningful, like your
project name - see the examples in the section above
As far as your ivy:publish target goes, there is a required attribute -
'resolver' but normally I find that I need to specify the pubrevision as
well.
See examples in:
http://ant.apache.org/ivy/history/latest-milestone/use/publish.html
But, I wouldn't class myself as an "expert" on Ivy - I just use it a
lot. I find the best approach is to read the documentation *very*
carefully, and then take the examples and tweak them to do what I need.
Ivy is a very powerful beast but there are a number of traps for the unwary.
Alan