Re: maven-plugin-tools-ant custom parameter
On Tue, Jan 17, 2012 at 10:43:10PM +0100, Robert Scholte wrote: Hi Max, Don't confuse a mojo with a pojo. The Mojo reflects the actual goal, supports injection, etc, etc. A pojo is just that plain old java object: private fields with their getters and setters Only for mojo's the @parameters can be used. Such field can be of a lot of types: String, primitive, pojo, array or List of one of these types (as long as Plexus can transform it) The @parameter on the name of the person won't work. It would be nice if the rules were documented somewhere. I strongly advice you to first read the 5 minutes[1] and 30 minutes[2] tutorials. I wish him luck. They leave a lot out. At least, I *think* they do, because I had a lot of questions that don't seem to be answered anywhere. I went digging in the code, wound up deep inside Plexus, submitted a documentation patch for the bits I managed to understand, but still felt no certainty. So what *are* we supposed to do if we want structured parameters? And where should I have read that? -- Mark H. Wood, Lead System Programmer mw...@iupui.edu Asking whether markets are efficient is like asking whether people are smart. pgpPbc6RUrz87.pgp Description: PGP signature
Re: maven-plugin-tools-ant custom parameter
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 : configurationpersonJohn /person/configuration i have : configurationpersonnameJason/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 apa...@sourcegrounds.comwrote: 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.htmlhttp://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 carpentier@gmail.com 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 goalsayhi/goal requiresProjecttrue/**requiresProject callsayhi-ant/call parameters parameter nameperson/name propertyperson/property requiredtrue/required expression${person}/**expression typemy.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 apa...@sourcegrounds.com **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 carpentier@gmail.com 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.htmlhttp:/**/maven.apache.org/guides/** plugin/guide-ant-plugin-**development.htmlhttp://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 groupIdorg.myproject.plugins/groupId artifactIdhello-plugin/artifactId version1.0-SNAPSHOT/version configuration nameJohn/name /configuration /plugin and in your xml mojo : parameter namename/name propertyname/property requiredtrue/required typejava.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_Objectshttp://maven.apache.** org/guides/mini/guide-**configuring-plugins.html#** Mapping_Complex_Objectshttp://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects configuration person firstNameJason/firstName lastNamevan 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.orghttp://apache.org users-unsubscribe@**maven.apache.orgusers-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org --**--**- To unsubscribe, e-mail: users-unsubscribe@maven.**apache.orgusers-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: maven-plugin-tools-ant custom parameter
Hi Max, Don't confuse a mojo with a pojo. The Mojo reflects the actual goal, supports injection, etc, etc. A pojo is just that plain old java object: private fields with their getters and setters Only for mojo's the @parameters can be used. Such field can be of a lot of types: String, primitive, pojo, array or List of one of these types (as long as Plexus can transform it) The @parameter on the name of the person won't work. I've never developed Ant Plugins for Maven 2.x, this is the first time I see this page. My impression is that this was written in the early days of Maven 2. I don't think there are a lot of people who are still developing Maven-plugins like this. I strongly advice you to first read the 5 minutes[1] and 30 minutes[2] tutorials. Next check if there is already a plugin which already solves your problem, you're probably not the first one [3] (at the bottom are some other maven-plugin communities) Unlike Ant it's much easier to reuse build-scripts/plugins. -Robert [1] http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html [2] http://maven.apache.org/guides/getting-started/index.html [3] http://maven.apache.org/plugins/index.html On Tue, 17 Jan 2012 15:22:05 +0100, Maxime Carpentier carpentier@gmail.com wrote: 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 : configurationpersonJohn /person/configuration i have : configurationpersonnameJason/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 apa...@sourcegrounds.comwrote: 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.htmlhttp://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 carpentier@gmail.com 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 goalsayhi/goal requiresProjecttrue/**requiresProject callsayhi-ant/call parameters parameter nameperson/name propertyperson/property requiredtrue/required expression${person}/**expression typemy.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 apa...@sourcegrounds.com **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 carpentier@gmail.com 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.htmlhttp:/**/maven.apache.org/guides/** plugin/guide-ant-plugin-**development.htmlhttp://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 groupIdorg.myproject.plugins/groupId artifactIdhello-plugin/artifactId version1.0-SNAPSHOT/version configuration nameJohn/name /configuration /plugin and in your xml mojo : parameter namename/name propertyname/property requiredtrue/required typejava.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_Objectshttp://maven.apache.** org/guides/mini/guide-**configuring-plugins.html#**
Re: maven-plugin-tools-ant custom parameter
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 goalsayhi/goal requiresProjecttrue/requiresProject callsayhi-ant/call parameters parameter nameperson/name propertyperson/property requiredtrue/required expression${person}/expression typemy.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 apa...@sourcegrounds.comwrote: 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 carpentier@gmail.com wrote: Hi, I'm developping a new plugin using ant, guided by http://maven.apache.org/**guides/plugin/guide-ant-** plugin-development.htmlhttp://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 groupIdorg.myproject.**plugins/groupId artifactIdhello-plugin/**artifactId version1.0-SNAPSHOT/**version configuration nameJohn/name /configuration /plugin and in your xml mojo : parameter namename/name propertyname/property requiredtrue/required typejava.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-** plugins.html#Mapping_Complex_**Objectshttp://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects configuration person firstNameJason/firstName lastNamevan 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.**apache.orgusers-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: maven-plugin-tools-ant custom parameter
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 -Robert On Mon, 16 Jan 2012 10:16:22 +0100, Maxime Carpentier carpentier@gmail.com 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 goalsayhi/goal requiresProjecttrue/requiresProject callsayhi-ant/call parameters parameter nameperson/name propertyperson/property requiredtrue/required expression${person}/expression typemy.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 apa...@sourcegrounds.comwrote: 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 carpentier@gmail.com wrote: Hi, I'm developping a new plugin using ant, guided by http://maven.apache.org/**guides/plugin/guide-ant-** plugin-development.htmlhttp://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 groupIdorg.myproject.**plugins/groupId artifactIdhello-plugin/**artifactId version1.0-SNAPSHOT/**version configuration nameJohn/name /configuration /plugin and in your xml mojo : parameter namename/name propertyname/property requiredtrue/required typejava.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-** plugins.html#Mapping_Complex_**Objectshttp://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects configuration person firstNameJason/firstName lastNamevan 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.**apache.orgusers-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
maven-plugin-tools-ant custom parameter
Hi, I'm developping a new plugin using ant, guided by 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 groupIdorg.myproject.plugins/groupId artifactIdhello-plugin/artifactId version1.0-SNAPSHOT/version configuration nameJohn/name /configuration /plugin and in your xml mojo : parameter namename/name propertyname/property requiredtrue/required typejava.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-plugins.html#Mapping_Complex_Objects configuration person firstNameJason/firstName lastNamevan Zyl/lastName /person /configuration I've tried several possible configurations but no success...any idea on how to do it ? Thanxs, Max
Re: maven-plugin-tools-ant custom parameter
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 carpentier@gmail.com wrote: Hi, I'm developping a new plugin using ant, guided by 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 groupIdorg.myproject.plugins/groupId artifactIdhello-plugin/artifactId version1.0-SNAPSHOT/version configuration nameJohn/name /configuration /plugin and in your xml mojo : parameter namename/name propertyname/property requiredtrue/required typejava.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-plugins.html#Mapping_Complex_Objects configuration person firstNameJason/firstName lastNamevan 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-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org