i've done something along those lines with the mojo's nbm-maven-plugin. I
call a bunch of ant tasks for building netbeans modules.
https://svn.codehaus.org/mojo/trunk/mojo/nbm-maven-plugin/

Milos

On 11/12/07, Pedro Viegas <[EMAIL PROTECTED]> 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
>

Reply via email to