You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Saket Lakshminarayan Chiluveru <Sa...@infosys.com> on 2009/01/12 08:35:46 UTC

Maven Parameters

Hi,

How can I pass a set of objects as parameters into a Mojo.

e.g an Xml of the following format

<Order>
                <id>123</id>
                <quant>8</quant>
</Order>

<Order>
                <id>123453</id>
                <quant>2</quant>
</Order>


I need to pass this into a collection of objects. How do I do this ?




Saket L.C
Technical Architect | CME | TELENET | Extn 74150

Do or Do Not, there is no try -- yoda (star wars)


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Re: Maven Parameters

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Add list of the objects to your mojo


/**
 * List of Orders
 *
 * @parameter
 */
private List<Order> orders = new ArrayList<Order>();

and in your pom.xml (within the config section of your mojo), specify
the following:

<orders>
  <order implemenation="some.package.Order">
    <id>123</id>
    <quant>8</quant>
  </order>

  ...

</orders>

See 'Parameter Types With Multiple Values' at [1] for more info.

Cheers,

Johan

[1] http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Saket Lakshminarayan Chiluveru wrote:
> Hi,
> 
> How can I pass a set of objects as parameters into a Mojo.
> 
> e.g an Xml of the following format
> 
> <Order>
>                 <id>123</id>
>                 <quant>8</quant>
> </Order>
> 
> <Order>
>                 <id>123453</id>
>                 <quant>2</quant>
> </Order>
> 
> 
> I need to pass this into a collection of objects. How do I do this ?
> 
> 
> 
> 
> Saket L.C
> Technical Architect | CME | TELENET | Extn 74150
> 
> Do or Do Not, there is no try -- yoda (star wars)
> 
> 
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
> for the use of the addressee(s). If you are not the intended recipient, please 
> notify the sender by e-mail and delete the original message. Further, you are not 
> to copy, disclose, or distribute this e-mail or its contents to any other person and 
> any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
> every reasonable precaution to minimize this risk, but is not liable for any damage 
> you may sustain as a result of any virus in this e-mail. You should carry out your 
> own virus checks before opening the e-mail or attachment. Infosys reserves the 
> right to monitor and review the content of all messages sent to or from this e-mail 
> address. Messages sent to or from this e-mail address may be stored on the 
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
> 

- --
you too?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJaykQpHYnED7evioRAv4IAJ9y7y1usI72TkmFrVaAB0bh4XOM2QCdE11p
H7sQJsQ+uqHRRcXdxb9l/58=
=g0yu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org