You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chirag Trivedi <ch...@yahoo.com> on 2009/05/14 12:30:39 UTC
Set parameters of a mojo through Java
Hi,
I am trying to execute a mojo from my mojo through java. I want to set parameters which are to be used by the mojo. From maven plugin, we can specify the parameters in pom.xml but through java how can I set the parameters?
Regards,
Chirag Trivedi
Cricket on your mind? Visit the ultimate cricket website. Enter http://beta.cricket.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Set parameters of a mojo through Java
Posted by Cl...@raibau.at.
I've seen two approaches:
1) if you are starting the Mojo using a MavenSession, you can set the
property defined in
@parameter expression="${propertyName}" for that parameter.
2) If you are invoking the methods in the Mojo by yourself, then the
parameters are probably private fields, and you can set them using
reflexion: Field f = SomeMojo.class.getDeclaredField("parameter");
f.setAccessible(); f.set(instanceOfSomeMojo, value);
______________________________________
Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten. Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns unverzueglich zu informieren und sie zu loeschen.
This e-mail message may contain information, which is confidential and protected. If you are not the intended recipient of this message, we ask you to inform us immediately and delete the message afterwards.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org