ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Gill" <llign...@gmail.com>
Subject Re: Using Extra Attributes
Date Sun, 07 Oct 2007 00:50:39 GMT
Sounds like there is never going to be a 1.4.2 release of ivy, even though
in JIRA there is an ivy 1.4.2 release. Maybe the issues against 1.4.2 should
be moved to a 2.0xxx release.

On 10/7/07, Nascif Abousalh-Neto <Nascif.AbousalhNeto@sas.com> wrote:
>
> I am using 1.4.1 because it is the stable version. It would be easier
> for our team to fix bugs and provide patches against the beta once it is
> released. Unfortunately this is for production and consumed by a really
> large number of developers in our corporation, and management just
> doesn't like the sound of "alpha"...
>
> I will add the unit test to a jira entry.
>
> Thanks,
>   Nascif
>
> -----Original Message-----
> From: Xavier Hanin [mailto:xavier.hanin@gmail.com]
> Sent: Saturday, October 06, 2007 11:18 AM
> To: ivy-user@incubator.apache.org
> Subject: Re: Using Extra Attributes
>
> On 10/5/07, Nascif Abousalh-Neto <Nascif.AbousalhNeto@sas.com> wrote:
> >
> > Thanks for the explanation. Perhaps some clarification that using
> extra
> > attributes require that you use the attribute as part of the pattern
> if
> > they are to be used to resolve dynamic versions should be added to the
> > web site.
>
>
> Indeed, extra attributes would deserve some more documentation. Maybe a
> tutorial, or a follow up to another tutorial... Since you have worked in
> this direction, maybe you could contribute something in this area?
>
>
> This is all I found in
> > http://incubator.apache.org/ivy/history/trunk/concept.html#extra
> >
> > Then you can use the extra attribute when you declare a dependency on
> > foo:
> > <dependency org="apache" name="foo" color="blue" rev="1.5+" />
> >
> > And since "1.5+" is a dynamic version I got the impression thar color
> > could be used to influence how it would be resolved.
>
>
> It should be possible if you use the color in your pattern.
>
> Anyway I tried to create a unit test to validate my use case:
> >     public void testExtraAttributesWithLatestInPattern() throws
> > Exception {
> >         Ivy ivy = new Ivy();
> >         ivy.configure(new
> >
> File("test/repositories/extra-attributes-multiple-versions/ivyconf.xml")
> > );
> >
> >         // without extra attribute in pattern
> >         //ResolveReport report =
> >
> ivy.resolve(ResolveTest.class.getResource("ivy-extra-att-latest-no-patte
> > rn.xml"),
> >
> >         //with extra attribute in pattern
> >         ResolveReport report =
> >
> ivy.resolve(ResolveTest.class.getResource("ivy-extra-att-latest-in-patte
> > rn.xml"),
> >                 null, new String[] {"*"}, _cache, null, false);
> >         assertFalse(report.hasError());
> >
> >         assertTrue(new File(_cache,
> > "jayasoft/mymodule/task1/1854/ivy.xml").exists());
> >         assertTrue(new File(_cache,
> > "jayasoft/mymodule/task1/1854/mymodule-windows.jar").exists());
> >         assertTrue(new File(_cache,
> > "jayasoft/mymodule/task1/1854/mymodule-linux.jar").exists());
> >     }
> >
> > Where mymodule has also another version, 2854 with eatt == task2, and
> > where I use "eatt" in the pattern as in the original test case. The
> > result was not much better:
> >
> >   <testcase classname="fr.jayasoft.ivy.ResolveTest"
> > name="testExtraAttributesWithLatestInPattern" time="0.031">
> >     <error
> > type="java.lang.NullPointerException">java.lang.NullPointerException
> >         at
> >
> fr.jayasoft.ivy.repository.url.URLResource.getName(URLResource.java:30)
> >         at
> >
> fr.jayasoft.ivy.external.m2.PomModuleDescriptorParser.accept(PomModuleDe
> > scriptorParser.java:262)
> >         at
> >
> fr.jayasoft.ivy.parser.ModuleDescriptorParserRegistry.getParser(ModuleDe
> > scriptorParserRegistry.java:58)
> >         at fr.jayasoft.ivy.Ivy.resolve(Ivy.java:1083)
> >         at fr.jayasoft.ivy.Ivy.resolve(Ivy.java:1071)
> >         at fr.jayasoft.ivy.Ivy.resolve(Ivy.java:1068)
> >         at fr.jayasoft.ivy.Ivy.resolve(Ivy.java:1025)
> >         at fr.jayasoft.ivy.Ivy.resolve(Ivy.java:1022)
> >         at
> >
> fr.jayasoft.ivy.ResolveTest.testExtraAttributesWithLatestInPattern(Resol
> > veTest.java:2595)
>
>
> Could you open an issue and provide your unit test as a patch? It would
> be
> easier for us to see exactly what you are testing, and to include the
> test
> if it is relevant. BTW, it seems you are using 1.4, a patch against
> current
> trunk would be more appreciated :-)
>
> Xavier
>
> I think I found another way to implement my needs though.
> > Thanks,
> >   Nascif
> >
> > -----Original Message-----
> > From: Xavier Hanin [mailto:xavier.hanin@gmail.com]
> > Sent: Friday, October 05, 2007 1:01 PM
> > To: ivy-user@incubator.apache.org
> > Subject: Re: Using Extra Attributes
> >
> > 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/
> >
>
>
>
> --
> Xavier Hanin - Independent Java Consultant
> http://xhab.blogspot.com/
> http://incubator.apache.org/ivy/
> http://www.xoocode.org/
>



-- 
Regards,
John Gill

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