You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by DE GOEDE Tony <to...@nl.thalesgroup.com> on 2011/06/30 09:48:41 UTC
annotate complex types in lists
Hello,
I have a problem.
I am building a new maven plugin to interface with a local build tool.
To control the plugin I supply some configuration data. For simple elements this works using annotations.
Because we want to configure maven to get the correct target artifacts from nexus for the current platform, we need more complex type of configuration data. Example:
<configuration>
<platform_mapping>
<platform>
<host>linux64</host>
<targets>
<target>targetX</target>
<target>targetY</target>
</targets>
</platform>
<platform>
<host>linux</host>
<targets>
<target>targetZ</target>
</targets>
</platform>
</platform_mapping>
etc
How do I annotate this list in my plugin.
There is no example on the maven website for a list of complex data types.
Does anybody knows how to implement this, have an alternative or maybe have an example of how to do it.
I am very unfamiliar in programming plugins and in using java.
Thanks in advance.
[cid:image001.jpg@01CC3709.022A6D30]
Tony de Goede
Software Engineer
Sensors
Phone:
+31 (0)74 248 4599
Mobile:
+31 (0)6 4405 7890
E-mail:
tony.degoede@nl.thalesgroup.com<ma...@nl.thalesgroup.com>
THALES NEDERLAND
Haaksbergerstraat 49
7554 PA Hengelo
PO Box 42
7550 GD Hengelo
The Netherlands
www.thalesgroup.com/nl<http://www.thalesgroup.com/nl>
------------------------------------------------------------------------------------------------------------
Disclaimer:
If you are not the intended recipient of this email, please notify the sender and delete it.
Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden.
Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s).
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------
RE: annotate complex types in lists
Posted by DE GOEDE Tony <to...@nl.thalesgroup.com>.
Hello Jeff,
I tried following the description and it simply worked.
I created a class Platform with the attributes.
And
/**
* The build platforms
*
* @parameter
* @required
*/
private Platform[] platform_mappings;
This works fine.
Thanks for your experience and support.
Greetings,
Tony de Goede
tony.degoede@nl.thalesgroup.com <ma...@nl.thalesgroup.com>
Thales Nederland BV
P.O.BOX 42
Zuidelijke havenweg 40
7554 RR Hengelo (Overijssel)
Netherlands
(0031) (0)74 2484599
================= [Unclassified] ===================
-----Original Message-----
From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff MAURY
Sent: Thursday, 30 June, 2011 10:47
To: Maven Developers List
Subject: Re: annotate complex types in lists
Tony,
the simplest way of doing is to use Arrays. If you must use List, then look at the Mojo documentation as there are some limitations:
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects
Regards
Jeff MAURY
On Thu, Jun 30, 2011 at 9:48 AM, DE GOEDE Tony < tony.degoede@nl.thalesgroup.com> wrote:
> Hello,****
>
> ** **
>
> I have a problem.****
>
> ** **
>
> I am building a new maven plugin to interface with a local build
> tool.****
>
> To control the plugin I supply some configuration data. For simple
> elements this works using annotations.****
>
> Because we want to configure maven to get the correct target artifacts
> from nexus for the current platform, we need more complex type of
> configuration data. Example:****
>
> ** **
>
> <configuration>****
>
> <platform_mapping>****
>
> <platform>****
>
> <host>linux64</host>****
>
> <targets>****
>
> <target>targetX</target>****
>
> <target>targetY</target>****
>
> </targets>****
>
> </platform>****
>
> ** **
>
> <platform>****
>
> <host>linux</host>****
>
> <targets>****
>
> <target>targetZ</target>****
>
> </targets>****
>
> </platform>****
>
> </platform_mapping>****
>
> etc****
>
> ** **
>
> How do I annotate this list in my plugin.****
>
> There is no example on the maven website for a list of complex data types.
> ****
>
> ** **
>
> Does anybody knows how to implement this, have an alternative or maybe
> have an example of how to do it.****
>
> I am very unfamiliar in programming plugins and in using java.****
>
> ** **
>
> Thanks in advance.****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> [image: Description: Thales Nederland]****
>
> *Tony de Goede*****
>
> Software Engineer****
>
> Sensors****
>
> ** **
>
>
> Phone:****
>
>
> +31 (0)74 248 4599****
>
> Mobile:****
>
> +31 (0)6 4405 7890****
>
> E-mail:****
>
> tony.degoede@nl.thalesgroup.com****
>
> ** **
>
>
> *THALES NEDERLAND*****
>
> Haaksbergerstraat 49****
>
> 7554 PA Hengelo****
>
>
> PO Box 42****
>
> 7550 GD Hengelo****
>
> The Netherlands****
>
> www.thalesgroup.com/nl****
>
> ** **
>
> ** **
>
> ----------------------------------------------------------------------
> --------------------------------------
> Disclaimer:
>
> If you are not the intended recipient of this email, please notify the sender and delete it.
> Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden.
> Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s).
> Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.
> ----------------------------------------------------------------------
> --------------------------------------
>
>
>
--
"Legacy code" often differs from its suggested alternative by actually working and scaling.
- Bjarne Stroustrup
http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury
------------------------------------------------------------------------------------------------------------
Disclaimer:
If you are not the intended recipient of this email, please notify the sender and delete it.
Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden.
Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s).
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: annotate complex types in lists
Posted by Jeff MAURY <je...@jeffmaury.com>.
Tony,
the simplest way of doing is to use Arrays. If you must use List, then look
at the Mojo documentation as there are some limitations:
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects
Regards
Jeff MAURY
On Thu, Jun 30, 2011 at 9:48 AM, DE GOEDE Tony <
tony.degoede@nl.thalesgroup.com> wrote:
> Hello,****
>
> ** **
>
> I have a problem.****
>
> ** **
>
> I am building a new maven plugin to interface with a local build tool.****
>
> To control the plugin I supply some configuration data. For simple elements
> this works using annotations.****
>
> Because we want to configure maven to get the correct target artifacts from
> nexus for the current platform, we need more complex type of configuration
> data. Example:****
>
> ** **
>
> <configuration>****
>
> <platform_mapping>****
>
> <platform>****
>
> <host>linux64</host>****
>
> <targets>****
>
> <target>targetX</target>****
>
> <target>targetY</target>****
>
> </targets>****
>
> </platform>****
>
> ** **
>
> <platform>****
>
> <host>linux</host>****
>
> <targets>****
>
> <target>targetZ</target>****
>
> </targets>****
>
> </platform>****
>
> </platform_mapping>****
>
> etc****
>
> ** **
>
> How do I annotate this list in my plugin.****
>
> There is no example on the maven website for a list of complex data types.
> ****
>
> ** **
>
> Does anybody knows how to implement this, have an alternative or maybe have
> an example of how to do it.****
>
> I am very unfamiliar in programming plugins and in using java.****
>
> ** **
>
> Thanks in advance.****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> [image: Description: Thales Nederland]****
>
> *Tony de Goede*****
>
> Software Engineer****
>
> Sensors****
>
> ** **
>
>
> Phone:****
>
>
> +31 (0)74 248 4599****
>
> Mobile:****
>
> +31 (0)6 4405 7890****
>
> E-mail:****
>
> tony.degoede@nl.thalesgroup.com****
>
> ** **
>
>
> *THALES NEDERLAND*****
>
> Haaksbergerstraat 49****
>
> 7554 PA Hengelo****
>
>
> PO Box 42****
>
> 7550 GD Hengelo****
>
> The Netherlands****
>
> www.thalesgroup.com/nl****
>
> ** **
>
> ** **
>
> ------------------------------------------------------------------------------------------------------------
> Disclaimer:
>
> If you are not the intended recipient of this email, please notify the sender and delete it.
> Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden.
> Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s).
> Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.
> ------------------------------------------------------------------------------------------------------------
>
>
>
--
"Legacy code" often differs from its suggested alternative by actually
working and scaling.
- Bjarne Stroustrup
http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury