Thanxs Robert, but i still don't get it i'm just replacing my String object (which works fine) by a Person object so instead of having in my project's pom :
<configuration><person>John </person></configuration> i have : <configuration><person><name>Jason</name></person></configuration> Doesn't it work this way ? : plugin mojo.xml : declaring properties used in build.xml plugin build.xml : executed part, using properties declared in mojo.xml and valued in project's pom project pom : defining properties value In a more simple exemple, how to use a List instead of a String parameter ? i'm using maven-plugin-tools-ant because i'd like use an already existing build.xml file... Thanxs for your help, Max On Mon, Jan 16, 2012 at 6:29 PM, Robert Scholte <[email protected]>wrote: > Yes you're missing something. > If we keep it very simple: you can use properties to set the > configuration, but you can't use configuration to set a property. > I'm wondering why you're using Ant and not just making an Mojo. > > Please check http://www.sonatype.com/books/** > mvnref-book/reference/writing-**plugins-sect-mojo-params.html<http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-mojo-params.html> > > -Robert > > > On Mon, 16 Jan 2012 10:16:22 +0100, Maxime Carpentier < > [email protected]> wrote: > > yes, but i'm not sure about my hello.mojos.xml : >> >> *Person.java :* >> >> package my.test.maven; >> >> public class Person { >> /** >> * @parameter expression="${cvs.name}" >> */ >> private String name; >> public String getName() { >> return name; >> } >> public void setName(String name) { >> this.name= name; >> } >> } >> >> *hello.mojos.xml :* >> >> >> <pluginMetadata> >> <mojos> >> <mojo> >> <goal>sayhi</goal> >> <requiresProject>true</**requiresProject> >> <call>sayhi-ant</call> >> <parameters> >> <parameter> >> <name>person</name> >> <property>person</property> >> <required>true</required> >> <expression>${person}</**expression> >> <type>my.test.maven.Person</**type> >> </parameter> >> <parameters> >> <mojos> >> <mojo> >> <pluginMetadata> >> >> and in my hello.build.xml : <echo message="Hello ${person} - ${ >> person.name} >> " /> outputs : Hello ${person} - ${person.name} >> did i miss something ? >> >> On Fri, Jan 13, 2012 at 9:21 PM, Robert Scholte <[email protected] >> >**wrote: >> >> have you tried to create a pojo called Person (with getters + setters for >>> firstName and lastName) in the same package as the mojo? >>> did you add something like this to the mojo >>> >>> /** >>> * @parameter >>> */ >>> private Person person; >>> >>> >>> -Robert >>> >>> >>> >>> On Fri, 13 Jan 2012 11:53:53 +0100, Maxime Carpentier < >>> [email protected]> wrote: >>> >>> Hi, >>> >>>> I'm developping a new plugin using ant, guided by >>>> http://maven.apache.org/****guides/plugin/guide-ant-**<http://maven.apache.org/**guides/plugin/guide-ant-**> >>>> plugin-development.html<http:/**/maven.apache.org/guides/** >>>> plugin/guide-ant-plugin-**development.html<http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html> >>>> > >>>> >>>> . >>>> In this tutorial you can see how to map parameter for your plugin, >>>> declaring in your pom.xml : >>>> >>>> <plugin> >>>> <groupId>org.myproject.****plugins</groupId> >>>> <artifactId>hello-plugin</****artifactId> >>>> <version>1.0-SNAPSHOT</****version> >>>> >>>> >>>> <configuration> >>>> <name>John</name> >>>> </configuration> >>>> </plugin> >>>> >>>> and in your xml mojo : >>>> >>>> <parameter> >>>> <name>name</name> >>>> <property>name</property> >>>> <required>true</required> >>>> <type>java.lang.String</type> >>>> ... >>>> </parameter> >>>> >>>> but what i actually want to do is using complex objects, as described >>>> here >>>> : >>>> http://maven.apache.org/****guides/mini/guide-configuring-****<http://maven.apache.org/**guides/mini/guide-configuring-**> >>>> plugins.html#Mapping_Complex_****Objects<http://maven.apache.** >>>> org/guides/mini/guide-**configuring-plugins.html#** >>>> Mapping_Complex_Objects<http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects> >>>> > >>>> >>>> >>>> <configuration> >>>> <person> >>>> <firstName>Jason</firstName> >>>> <lastName>van Zyl</lastName> >>>> </person> >>>> </configuration> >>>> >>>> I've tried several possible configurations but no success...any idea >>>> on how to do it ? >>>> Thanxs, >>>> >>>> Max >>>> >>>> >>> ------------------------------****----------------------------** >>> --**--------- >>> To unsubscribe, e-mail: >>> users-unsubscribe@maven.**apac**he.org<http://apache.org> >>> <users-unsubscribe@**maven.apache.org<[email protected]> >>> > >>> >>> For additional commands, e-mail: [email protected] >>> >>> > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@maven.**apache.org<[email protected]> > For additional commands, e-mail: [email protected] > >
