I would like to use the 1st option however I am unsure of how to configure 
the setup. The 3rd part ant task has code like the following:

if (projectFile == null)
throw new BuildException("missing required attribute 'projectFile'");
Java javaTask = (Java) getProject().createTask("java");
// set the properties on the Java task here
int returnValue = javaTask.executeJava();

The rest of the code is just getters and setters plus a few utility methods 
which ultimately end up forwarding the properties settings to the new Java 
task. From the above I gather that I need to have an ant Project instance to 
create the Java task from, is this true and if so is there an example of how 
to do this?

Wb


So if I was to use option one, would I just add a dependency to my plugin 
for ant-1.6.5



On 9/7/05, dan tran <[EMAIL PROTECTED]> wrote:
> 
> Hi Wendell,
>  You have 3 options:
>   - invoke ant task directly within your mojo by setting up the neccesary 
> dependencies
>  then call the ant task class' execute method.
>   - Invoke the maven-executor-plugin, a generic mojo to invoke any java's 
> main method. 
>  It is still in the sanbox of at http://mojo.codehause.com
>   - I also have maven-exec-plugin, still in my local diskspace, which can 
> invoke any 
>  native executable. I have not proposed to check it into 
> mojo.codehaus.com<http://mojo.codehaus.com>'s 
> sanbox
>  yet, since i dont see a demand for it yet. 
>  -D
>  On 9/7/05, Wendell Beckwith <[EMAIL PROTECTED]> wrote: 
> > 
> > I'm now trying to write a maven 2 plugin to execute a 2rd party's tools
> > command line class. The class is written is java. The tool also has an 
> > ant 
> > task which just uses the Java task in ant to invoke the command line 
> > tool in
> > a forked jvm. Does m2 already provide such functionality and I just 
> > haven
> > seen it? Or barring that, can I add a dependency on a set of plugins 
> > that 
> > will allow my plugn to instantiate the the ant Java task, configure it 
> > and
> > then call its execute() method.
> > 
> > I'm trying to avoid having end users create an additional build.xml, 
> > instead
> > I'd rather they just configure my plugin in the pom, and I can 
> > internally 
> > configure the ant Java task and invoke it.
> > 
> > Wb
> > 
> > 
>

Reply via email to