ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <xavier.ha...@gmail.com>
Subject Re: Question on attributes
Date Thu, 28 Aug 2008 16:07:49 GMT
On Thu, Aug 28, 2008 at 4:30 AM, Nascif Abousalh-Neto <
Nascif.AbousalhNeto@sas.com> wrote:

> Hi,
>
> I am considering the use of extra attributes to store the result of a
> process that is executed as part of the build, just before we publish the
> new version. I think it would meet our needs and allow us to optimize the
> process of recovering this information (since we will later have to recover
> the module anyway).
>
> My concern though is this paragraph in the Ivy documentation (from
> http://ant.apache.org/ivy/history/trunk/concept.html)
> Example:
> Here is an ivy file with the attribute 'color' set to blue:
> <ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
>        <info organisation="apache"
>               module="foo"
>               e:color="blue"
>               status="integration"
>               revision="1.59"
>        />
> </ivy-module>
> Then you must use the extra attribute when you declare a dependency on foo.
> Those extra attributes
> will indeed be used as identifier for the module like the org the name and
> the revision:
> <dependency org="apache" name="foo" e:color="blue" rev="1.5+" />
> And you can define your repository pattern as:
>
> ${repository.dir}/[organisation]/[module]/[color]/[revision]/[artifact].[ext]
>
> It says that I "must use the extra attribute", but what if I don't want to?
> I don't want to change the layout of my repository or change all my ivy.xml
> dependencies, I just want to use an extra attribute as an annotation or a
> tag, that I might (or not) refer to later after resolving the module.
>
> Would that be possible?

Well, extra attributes on the info tag are considered as identifying
attributes, and as such do not really fit what you want. But if all you need
is adding data, you can put it as a subelement of the info element:
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
       <info organisation="apache"
              module="foo"
              status="integration"
              revision="1.59" >
           <e:color>blue</e:color>
       </info>
</ivy-module>
Then you can use xml parsing to get the value of your extra element. Note
that this won't be parsed by Ivy itself, if you want to parse it, you can
create a custom Ivy parser extending the default one.

Does this match your need?

Xavier


> Thanks,
>  Nascif
>
> -------------------------------------------------------------------
> Nascif Abousalh-Neto
> Software Development Manager
> Query and Reporting  ▪ Business Intelligence Clients
> Tel: + 1 919 531 0123 - Nascif.AbousalhNeto@sas.com
> www.sas.com
> SAS(R) … THE POWER TO KNOW(R)
>
>
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message