ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chaney <a...@writingshow.com>
Subject Re: ivy:publish vs publications
Date Thu, 15 Sep 2011 13:32:47 GMT
On 9/15/2011 6:20 AM, zharvey wrote:
> 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>
>
> 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.
Try something like:

<target name="publish">
      <ivy:publish resolver="pubRepo">
          <artifacts pattern="dist/[artifact]-[revision].[ext]"/>
      </ivy:publish>
</target>

This will take all the defaults from the ivy settings you are using. I assume that your ant
'basedir' ===
workspace\MyProject\

Alan



>
> Alan Chaney-2 wrote:
>> 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
>>
>>
>>
>>
>>
>>


Mime
View raw message