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: Using Extra Attributes
Date Fri, 05 Oct 2007 17:00:53 GMT
On 10/5/07, Nascif Abousalh-Neto <Nascif.AbousalhNeto@sas.com> wrote:
>
> I apologise, I should have included the snippets in the first e-mail.
>
> I am testing this by making changes to the multi-project example.
> So I tweaked ivy.xml and published the following revisions of the
> "version" project (below are snippets for each version's published
> ivy.xml in the repository):
>
> <ivy-module version="1.0">
>     <info organisation="jayasoft" module="version" revision="7"
> status="release" publication="20071004180756" week="41"/>
>
> <ivy-module version="1.0">
>     <info organisation="jayasoft" module="version" revision="8"
> status="release" publication="20071004180824" week="42"/>
>
> <ivy-module version="1.0">
>     <info organisation="jayasoft" module="version" revision="9"
> status="integration" publication="20071004180848"/>
>
> The in the consumer project "list", I changed the dependency to read:
>     <dependency name="version" rev="latest.release" conf="core"
> week="41"/>
>
> and executed "ant resolve" with a clean cache. From the logs I can see
> that Ivy goes over all the versions
> [ivy:retrieve] pre 1.3 ivy file: using exactOrRegexp as default matcher
> [ivy:retrieve]  shared: parsed downloaded md file for [ jayasoft |
> version | latest.release ] parsed=[ jayasoft | version | 7 ]
>
>
> [ivy:retrieve] pre 1.3 ivy file: using exactOrRegexp as default matcher
> [ivy:retrieve]  shared: parsed downloaded md file for [ jayasoft |
> version | latest.release ] parsed=[ jayasoft | version | 8 ]
>
> [ivy:retrieve] pre 1.3 ivy file: using exactOrRegexp as default matcher
> [ivy:retrieve]  shared: parsed downloaded md file for [ jayasoft |
> version | latest.release ] parsed=[ jayasoft | version | 9 ]
>
> [ivy:retrieve] pre 1.3 ivy file: using exactOrRegexp as default matcher
> [ivy:retrieve]  shared: parsed downloaded md file for [ jayasoft |
> version | latest.release ] parsed=[ jayasoft | version | 9 ]
>
> After reading all the revisions in the repository, Ivy decides to ask
> for the revision "8" jar file.
>
> [ivy:retrieve]  listing all in
> C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/../tpj/j
> ayasoft/version/ivy-[revision].xml
> [ivy:retrieve]  using tpj to list all in
> C:/home/dev/IvyNextGen/multi-project/projects/list/../../common/../tpj/j
> ayasoft/version
> [ivy:retrieve]  tpj: unable to list resources for [ jayasoft | version |
> latest.release ]:
> pattern=C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/
> ../tpj/[organisation]/[module]/ivy-[revision].[ext]
> [ivy:retrieve]   trying
> C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/../tpj/j
> ayasoft/version/jars/version-latest.release.jar
> [ivy:retrieve]  listing all in
> C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/../tpj/j
> ayasoft/version/jars/version-[revision].jar
> [ivy:retrieve]  using tpj to list all in
> C:/home/dev/IvyNextGen/multi-project/projects/list/../../common/../tpj/j
> ayasoft/version/jars
> [ivy:retrieve]  tpj: unable to list resources for [ jayasoft | version |
> latest.release ]:
> pattern=C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/
> ../tpj/[organisation]/[module]/jars/[artifact]-[revision].[ext]
> [ivy:retrieve]  tpj: no ivy file nor artifact found for [ jayasoft |
> version | latest.release ]
> [ivy:retrieve]          tried
> C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/../tpj/j
> ayasoft/version/ivy-latest.release.xml
> [ivy:retrieve]          tried
> C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/../tpj/j
> ayasoft/version/ivy-[any release].xml
> [ivy:retrieve]          tried
> C:\home\dev\IvyNextGen\multi-project\projects\list/../../common/../tpj/j
> ayasoft/version/jars/version-latest.release.jar
> [ivy:retrieve]  found [ jayasoft | version | 8 ] in shared
> [ivy:retrieve]  [8] [ jayasoft | version | latest.release ]
>
> I would think it should ask for revision "7" since it is the one with
> the "week=41" attribute.


Ok, let's say that this is a limitation of what you can do with extra
attributes.  With most of the version matchers Ivy tries to avoid to read
the module descriptor to know if a version match or not. In your case you
use a version constraint which needs to load the ivy files, but Ivy do not
take advantage of this to filter the extra attributes. This could be
changed, but then it would be strange that when you use
latest.integration(which do not require module descriptor loading),
Ivy wouldn't take care of
the extra attribute. Loading module descriptors systematically as soon as
you use extra attributes is not a good idea either: may users use extra
attributes without this need.

So, what's the solution? You need to add your extra attribute in your
pattern, so that Ivy can know the value of the extra attribute depending on
the ivy file location only, and not its content. Then your
latest.releasewith your "week" extra attribute should work properly.

On a related question, can I use the "publication" attribute to retrieve
> a dependency?


Do you mean as a constraint on the dependency you select? Out of the box you
can't, but maybe you can write a custom VersionMatcher for that. But you
will need to parse the module descriptor to do so, which can be quite
expensive.

Xavier

Thanks,
>   Nascif
>
>
> -----Original Message-----
> From: Xavier Hanin [mailto:xavier.hanin@gmail.com]
> Sent: Friday, October 05, 2007 3:21 AM
> To: ivy-user@incubator.apache.org
> Subject: Re: Using Extra Attributes
>
> On 10/5/07, Nascif Abousalh-Neto <Nascif.AbousalhNeto@sas.com> wrote:
> >
> > I can't get extra attributes to work in 1.4.1, is this really
> supported?
> > I am looking at the functionality described in
> > http://incubator.apache.org/ivy/history/1.4.html
> > Under "Core features"
> >
> > and I tried a lot of combinations with extra attribute. I can see them
> > in the published ivy.xml, but there is no way that I can use them to
> > influence the result of my retrieve as suggested in the examples.
> >
> > Is anybody using this feature?
>
>
> I have in the past, and we have some unit tests checking it's working,
> so
> I'd be surprised if it doesn't work at all. Could you provide  some
> snippets
> of what you do and what you expect?
>
> Xavier
>
> Thanks,
> >   Nascif
> >
> >
> >
>
>
> --
> Xavier Hanin - Independent Java Consultant
> http://xhab.blogspot.com/
> http://incubator.apache.org/ivy/
> http://www.xoocode.org/
>



-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://incubator.apache.org/ivy/
http://www.xoocode.org/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message