Return-Path: Delivered-To: apmail-maven-users-archive@www.apache.org Received: (qmail 15841 invoked from network); 14 Nov 2005 20:27:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Nov 2005 20:27:50 -0000 Received: (qmail 58559 invoked by uid 500); 14 Nov 2005 20:27:44 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 58526 invoked by uid 500); 14 Nov 2005 20:27:44 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 58515 invoked by uid 99); 14 Nov 2005 20:27:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2005 12:27:44 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [130.207.192.26] (HELO mercury.gatech.edu) (130.207.192.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2005 12:27:35 -0800 Received: from mercury.gatech.edu (localhost [127.0.0.1]) by mercury.gatech.edu (Postfix) with SMTP id 84E43EB2A for ; Mon, 14 Nov 2005 15:27:22 -0500 (EST) (envelope-from Richard.Allen@gtri.gatech.edu) Received: from APATLITDMAIL03.core.gtri.org (unknown [130.207.211.21]) by mercury.gatech.edu (Postfix) with ESMTP id 57D0DEB15 for ; Mon, 14 Nov 2005 15:27:22 -0500 (EST) (envelope-from Richard.Allen@gtri.gatech.edu) Received: from APATLSTLMAIL04.stl.gtri.org ([130.207.197.70]) by APATLITDMAIL03.core.gtri.org with Microsoft SMTPSVC(6.0.3790.1830); Mon, 14 Nov 2005 15:27:22 -0500 Received: from [130.207.197.174] ([130.207.197.174]) by APATLSTLMAIL04.stl.gtri.org with Microsoft SMTPSVC(6.0.3790.1830); Mon, 14 Nov 2005 15:27:21 -0500 Message-ID: <4378F329.5050700@gtri.gatech.edu> Date: Mon, 14 Nov 2005 15:27:21 -0500 From: Richard Allen User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Maven Users List Subject: Re: [m2] How to inject values into a bean within a collection definedas a plugin parameter? References: <82533828A9FA7E4292F08A1D132304813FA8C7@itomae2km04.AD.QINTRA.COM> In-Reply-To: <82533828A9FA7E4292F08A1D132304813FA8C7@itomae2km04.AD.QINTRA.COM> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Nov 2005 20:27:22.0010 (UTC) FILETIME=[D12437A0:01C5E959] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N For now, I've added a set method on the Options class for setting a default directory, which I get from a parameter in the Mojo. This is essentially what you suggested I could do. I just don't think it is very clean, and I see how it could be useful (and in this case cleaner) if Maven could process annotations on beans in collections that are defined as Mojo parameters. Thanks, Richard Allen Allison, Bob wrote: >The configuration should look like (assuming that your definition of >parameter directory is actually specified as "private String >directory"): > > > > > > >I don't think that the expressions and default values available in the >Mojo are available in the classes used in this manner. A workaround >might be to place variables which require an expression as a parameter >in the Mojo itself and have a way to propagate it to the sub-objects. > >-----Original Message----- >From: Richard Allen [mailto:richard.allen@gtri.gatech.edu] >Sent: Monday, November 14, 2005 14:59 >To: users@maven.apache.org >Subject: [m2] How to inject values into a bean within a collection >definedas a plugin parameter? > > >I have an array (same question applies to Java Collections) that is >defined as a parameter of a Mojo: > >public class MyMojo extends AbstractMojo { >... > /** > * @parameter > * @required > */ > private Options[] optionsArray; >... >} > >and within the Options bean, I would like to inject properties from >Maven: > >public class Options { >... > /** > * @parameter expression="${project.build.directory}" > */ > private directory; >... >} > >such that the plugin can be configured like: > > > ... > > > ... > > > > ... > > > ... > > > > ... > > > > >Is there a way to make this happen? It seems like I should be able to do > >this since Maven is creating and populating the bean classes (Options >class). > >Thanks, >Richard Allen > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org >For additional commands, e-mail: users-help@maven.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org >For additional commands, e-mail: users-help@maven.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org