Return-Path: Delivered-To: apmail-incubator-ivy-user-archive@locus.apache.org Received: (qmail 49279 invoked from network); 14 Jan 2008 12:59:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Jan 2008 12:59:39 -0000 Received: (qmail 93681 invoked by uid 500); 14 Jan 2008 12:59:29 -0000 Delivered-To: apmail-incubator-ivy-user-archive@incubator.apache.org Received: (qmail 93665 invoked by uid 500); 14 Jan 2008 12:59:28 -0000 Mailing-List: contact ivy-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ivy-user@incubator.apache.org Delivered-To: mailing list ivy-user@incubator.apache.org Received: (qmail 93656 invoked by uid 99); 14 Jan 2008 12:59:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2008 04:59:28 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [140.254.80.232] (HELO troy.bmi.ohio-state.edu) (140.254.80.232) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2008 12:59:01 +0000 Content-class: urn:content-classes:message Subject: RE: How to use different retrieve rules for different organizations/modules? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 14 Jan 2008 07:59:00 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <24048DC1F8522C44B83040006BCC8FC37099C7@troy.bmi.ohio-state.edu> In-Reply-To: <635a05060801140109l74fe7d5fvd3a82ec646d4aa9c@mail.gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to use different retrieve rules for different organizations/modules? Thread-Index: AchWrTtgsIECY+TbTv6Ka/dWuiDHNw== References: <635a05060801140109l74fe7d5fvd3a82ec646d4aa9c@mail.gmail.com> From: "Scott Oster" To: "Xavier Hanin" , X-Virus-Checked: Checked by ClamAV on apache.org >>[originalname] That worked perfectly! I don't know how I missed that pattern; I've probably looked at that list like 10 times. >>IVY-324 Yes, I'd vote for that; its pretty much exactly what I was thinking. Scott -----Original Message----- From: Xavier Hanin [mailto:xavier.hanin@gmail.com]=20 Sent: Monday, January 14, 2008 4:09 AM To: ivy-user@incubator.apache.org Subject: Re: How to use different retrieve rules for different organizations/modules? On Jan 11, 2008 3:14 AM, Scott Oster wrote: > I did some additional searching of the mailing lists, and found a=20 > related thread: > > http://www.mail-archive.com/ivy-user@incubator.apache.org/msg01789.htm > l > > This thread describes the same requirement, and it seems the proposed=20 > solution was essentially what I came to (using specific confs for it). > The problem I have with this solution is the need to use revisions or=20 > not in the filename is generally not a function of each depending=20 > module, it's a function of the original artifacts (at least in the=20 > context of a bunch of projects/modules sharing ivy settings). > > > > For example, say I have a large product built from a large number of=20 > modules, and I am using Ivy for my dependency management. Across all=20 > of these modules, there are some artifacts I don't want to use=20 > revisions in the resolved files, and others I do. The problem is=20 > actually not specific to just artifact revisions, that just the most common use case. > As another example, consider the case where some artifacts are=20 > published with a common prefix, such as the organization name. Ivy is > extremely powerful in letting me specify artifact patterns to search=20 > my repository, such that I can handle all these cases. The problem is > that I don't have the same flexibility when it comes to actually=20 > retrieving the resolved files to my local project. That is, the=20 > information about how the original artifact was named in the=20 > repository is lost, and I pretty much need to use a common retrieve=20 > pattern for all my dependencies. I'd like "a way" to be able to say=20 > that I want to name the files the same as they were named in the=20 > repository. It's really not desirable to have each module have to=20 > know which of these artifacts have these constraints, and have to make > their own configurations just to handle these rules. This is a "build > smell" where this information has to be replicated in every module=20 > that depends on those modules/artifacts, even when it's for different=20 > reasons. Worse yet, a given module might have multiple configurations > that need such artifacts, and so would need multiple additional=20 > private configurations just to handle these custom retrieve rules. > > > > Please do let me know if there is a better way to address this. If=20 > not, I have two proposals, listed in order of preference: > > 1) Provide a way to specify that an artifact's name in the > repository is what should be used in the retrieve. I think you can use the [originalname] token for that as documented here: http://ant.apache.org/ivy/history/latest-milestone/concept.html#patterns I don't use this myself so I'm not absolutely sure it works with retrieve, but it should. > > One way to do this would be to add another artifact pattern that could > be used for retrieve. For example, consider "module A" publishes=20 > version 1.0 of artifact "A" as "A-1.0.jar" in one repository and=20 > "module B" publishes version 1.0 of artifact "B" as "B.jar" in another > repository, and that I have my ivy repository settings setup such that I > can properly locate the right artifacts. What I would like to be able > to do is specify an artifact pattern for the retrieve task that would=20 > look something like this: > > .../[conf]/[type]s/[artifact.filename] > > The new token, "artifact.filename" would be bound to the filename of=20 > the resolved artifact as found in the repository. So in the example,=20 > if I resolved a configuration that had dependencies on version 1.0 of=20 > both module A and module B, I would get a directory like this: > > myconf/ > > jars/ > > A-1.0.jar > > B.jar > > I also considered suggesting the ivy file syntax could be extended to=20 > support something like "preferred.filename" as an attribute on=20 > publications/artifact and that could be used as the retrieve pattern=20 > token, but just using the filename in the repository should suffice. > > 2) Support conditions on the retrieve task. Extending the retrieve task class to do what you want is pretty easy, you just need to call setArtifactFilter with the filter you want. Supporting conditions directly from Ant without requiring to develop a custom task in Java would be nice though, it's maybe one more vote for IVY-324. Xavier > > > Retrieve currently supports limiting the retrieve on things like=20 > organization, module, etc, but unless I'm doing something wrong it=20 > only seems to work against the depending module (i.e. the module doing > the retrieve), not the dependencies. I would like to be able to do=20 > multiple retrieves, but specify the constraints on which dependencies=20 > to actually pull. For the example above, I could do two retrieves and > specify "module B" as one module condition with my specialized pattern > (to remove the revision), and another with my default pattern with a=20 > condition of something like !"module B". This seems to be what is=20 > suggested here=20 > http://www.mail-archive.com/ivy-user@incubator.apache.org/msg01329.htm > l but it doesn't seem to do what I expect. If I try specify=20 > organization=3D"some organization I depend on", I get an=20 > illegalstateexception complaining that a report file doesn't exist. =20 > It appears to be looking for "some organization I depend on"#"mymodule. > > > > Scott > > > > > > > > > > From: Scott Oster > Sent: Thursday, January 10, 2008 5:05 PM > To: 'ivy-user@incubator.apache.org' > Subject: How to use different retrieve rules for different=20 > organizations/modules? > > > > Hi, > > I have a question on how I can handle organization or module specific=20 > rules for copying dependencies into my components. > > In general I want to resolve/retrieve my artifacts with a pattern like > this: > > .../[conf]/[type]s/[artifact]-[revision].[ext] > > However, for compatibility with my existing system, I need to copy=20 > some of the artifacts without the revision specified. For example, a=20 > pattern like this: > > .../[conf]/[type]s/[artifact].[ext] > > > > I cannot find a clean way to do this, short of defining specific=20 > private configurations in my module which include the relevant=20 > modules/organizations, and resolving these configurations separately. > This works, but its clutters up my ivy file (with all the=20 > configurations needed just to support this) and makes the=20 > resolve/retrieve part of my build much more complex (as I need=20 > multiple calls which specify specific configurations). > > > > Is there any way to set conditions on the retrieve pattern, or in my=20 > ivy file such that I could handle these special cases? The absolute=20 > ideal would be to handle this in the repository settings (such as=20 > having the retrieve use the same pattern used by the resolver), but=20 > I'm open to a module specific solution. > > > > Thanks for the great software and your help, > > Scott > > > > Scott Oster > > > > co-Director, Software Research Institute > > Biomedical Informatics Department > > Ohio State University > > oster@bmi.osu.edu > > lab: 614-292-9845 > > voice mail: 614-292-8680 > > > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/