annotate complex types in lists

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

annotate complex types in lists

tony de goede

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.

 

 

 

 

 

 

 

Tony de Goede

Software Engineer

Sensors

 


Phone:


+31 (0)74 248 4599

Mobile:

+31 (0)6 4405 7890

E-mail:

[hidden email]

 


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.
------------------------------------------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: annotate complex types in lists

Jeff MAURY
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 <
[hidden email]> 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:****
>
> [hidden email]****
>
> ** **
>
>
> *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
Reply | Threaded
Open this post in threaded view
|

RE: annotate complex types in lists

tony de goede
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
 
[hidden email] <mailto:[hidden email]>
Thales Nederland BV
P.O.BOX 42
Zuidelijke havenweg 40
7554 RR Hengelo (Overijssel)
Netherlands
(0031) (0)74 2484599
================= [Unclassified] ===================

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] 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 < [hidden email]> 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:****
>
> [hidden email]****
>
> ** **
>
>
> *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: [hidden email]
For additional commands, e-mail: [hidden email]