Just an idea

May be you can fork maven-antrun-plugin, and instead of let plexus bind
tasks attribute, instanciate tasks attribute with an xml file embded in you
plugin artifact

I was just having a look in AntRunMojo class but i think you have to use
AntTargetConverter 

This is just assumptions ...

Please keep me in touch


Pedro Viegas-2 wrote:
> 
> Hi there guys,
> 
> I am trying to create a Maven plugin that executes a given ANT task inside
> it.
> My real case is to call the Hibernate Tools task to generate a bunch of
> ORM
> classes and Hibernate mappings.
> But I need to make some decisions and have to pass some parameters to the
> several Hibernate Tools tasks I need to call depending on some conditions
> that I need to analize in a Java Mojo.
> 
> Basically I need to:
> 
>    1. Create a Mojo with some parameters and do some processing and file
>    generation of my own
>    2. Call the ANT Hibernate Tools tasks a bunch of times to generate all
>    my classes/mapings on several packages for several database schemas
>    3. Try to keep it as simple as possible to the end programmer user,
>    simply call a Maven plugin and state some configuration files and
>    destination package and let the conventioned behavior take charge.
> 
> I have created the first part easily by creating a Java Maven Plugin.
> The second part I have configured like a maven-ant-plugin addition to the
> POM and got it working, but this has to be copied into each of the
> projects
> that need this goal and all the configuration I could pragmatically do
> have
> to be typed repeatedly.
> So 1 and 2 are go, 3 is what I can't find any documentation or sample to
> help me.
> 
> I have seen the example from:
> http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html
> 
> But this is how to build a maven plugin with ANT. What I need is to build
> a
> maven plugin in Java that can call an ant task, like antrun plugin does
> but
> adding a few more java actions and decisions before and after.
> 
> So, how can I use the already running maven java plugin to call the ANT
> tasks?
> Can I call a plugin inside another plugin? How?
> Should I try to extend the maven-antrun-plugin to try to accomplish this?
> 
> Thanks in advance,
> 
> -- 
> Pedro Viegas
> 
> ------------------------------------------------------------
> Walking on water and developing software
> from a specification are easy if both are
> frozen.
>                         - Edward V. Berard
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-create-a-Mojo-that-controls-an-ANT-task-tf4788523s177.html#a13710554
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to