You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Markos Charatzas <cu...@gmail.com> on 2011/06/17 13:10:50 UTC

How to bind ant to a maven-plugin custom goal

The way to integrate maven with ant is to simply use the maven-antrun-plugin
like


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <id>package</id>                        
            <phase>package</phase>
            <configuration>
                <tasks>             
        <ant antfile="build.xml" target="package" />
      </tasks>
    </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>


in your project's pom.xml file

However I want to be able to have that associated build.xml script along
with the execution configuration as part of a maven plugin that defines a
custom packaging and a lifecycle.

Is there a way to do that?


--
View this message in context: http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4498426.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to bind ant to a maven-plugin custom goal

Posted by Markos Charatzas <cu...@gmail.com>.
Stephen, that's exactly what I needed. Thanks for that :)

I noticed the only way to pass property values is by having parameters to
specific mojos.
Judging by the 
http://maven.apache.org/plugin-tools/maven-plugin-tools-model/plugin-metadata-1.0.0.xsd
XSD specification  it doesn't look like there is an equivalent for global
ones.

Tried using the 'configuration' element under the 'maven-plugin-plugin'
plugin section but to no avail.

Is there another way or this is something currently not supported?

Thanks again.

--
View this message in context: http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4499207.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to bind ant to a maven-plugin custom goal

Posted by Stephen Connolly <st...@gmail.com>.
Here we go... I knew there was a doc somewhere:

http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html

On 17 June 2011 14:23, Stephen Connolly <st...@gmail.com>wrote:

> You basically wrap write your plugin in ANT. So specific goals corresponds
> to specific build.xml's. The parameters are defined and injected in (by
> properties IIRC) and it then behaves exactly like a Java plugin would.
>
> I agree that we should put out some documentation on how to write them
> though
>
>
> On 17 June 2011 13:55, Markos Charatzas <cu...@gmail.com> wrote:
>
>> Thanks for that Stephen. Documentation seems lacking so can't tell exactly
>> how ANT bindings is meant to be used.
>>
>> Is it for executing ant scripts from within Java? So effectively write a
>> custom MOJO for each goal executing a specific ant target?
>>
>> Mark, can't seem to find anything, on
>> http://www.sonatype.com/books/mvnref-book/reference/ the online version
>> at
>> least , related to ant bindings.
>>
>> --
>> View this message in context:
>> http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4498650.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

Re: How to bind ant to a maven-plugin custom goal

Posted by Stephen Connolly <st...@gmail.com>.
You basically wrap write your plugin in ANT. So specific goals corresponds
to specific build.xml's. The parameters are defined and injected in (by
properties IIRC) and it then behaves exactly like a Java plugin would.

I agree that we should put out some documentation on how to write them
though

On 17 June 2011 13:55, Markos Charatzas <cu...@gmail.com> wrote:

> Thanks for that Stephen. Documentation seems lacking so can't tell exactly
> how ANT bindings is meant to be used.
>
> Is it for executing ant scripts from within Java? So effectively write a
> custom MOJO for each goal executing a specific ant target?
>
> Mark, can't seem to find anything, on
> http://www.sonatype.com/books/mvnref-book/reference/ the online version at
> least , related to ant bindings.
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4498650.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to bind ant to a maven-plugin custom goal

Posted by Markos Charatzas <cu...@gmail.com>.
Thanks for that Stephen. Documentation seems lacking so can't tell exactly
how ANT bindings is meant to be used. 

Is it for executing ant scripts from within Java? So effectively write a
custom MOJO for each goal executing a specific ant target?

Mark, can't seem to find anything, on 
http://www.sonatype.com/books/mvnref-book/reference/ the online version at
least , related to ant bindings.

--
View this message in context: http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4498650.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to bind ant to a maven-plugin custom goal

Posted by Mark Struberg <st...@yahoo.de>.
There is an example of such a plugin in 'Maven - The Definitive Guide" available somewhere as free PDF I'm sure.

LieGrue,
strub

--- On Fri, 6/17/11, Stephen Connolly <st...@gmail.com> wrote:

> From: Stephen Connolly <st...@gmail.com>
> Subject: Re: How to bind ant to a maven-plugin custom goal
> To: "Maven Users List" <us...@maven.apache.org>
> Date: Friday, June 17, 2011, 11:22 AM
> create a maven plugin using the ANT
> bindings
> 
> http://maven.apache.org/plugin-tools/maven-plugin-tools-ant/index.html
> 
> I can't find the example for an ANT based plugin at the
> moment... should be
> more promenant though
> 
> On 17 June 2011 12:10, Markos Charatzas <cu...@gmail.com>
> wrote:
> 
> > The way to integrate maven with ant is to simply use
> the
> > maven-antrun-plugin
> > like
> >
> >
> > <plugin>
> >   
> <groupId>org.apache.maven.plugins</groupId>
> >   
> <artifactId>maven-antrun-plugin</artifactId>
> >    <version>1.6</version>
> >    <executions>
> >        <execution>
> >           
> <id>package</id>
> >           
> <phase>package</phase>
> >           
> <configuration>
> >               
> <tasks>
> >        <ant antfile="build.xml"
> target="package" />
> >      </tasks>
> >    </configuration>
> >           
> <goals>
> >               
> <goal>run</goal>
> >           
> </goals>
> >        </execution>
> >    </executions>
> > </plugin>
> >
> >
> > in your project's pom.xml file
> >
> > However I want to be able to have that associated
> build.xml script along
> > with the execution configuration as part of a maven
> plugin that defines a
> > custom packaging and a lifecycle.
> >
> > Is there a way to do that?
> >
> >
> > --
> > View this message in context:
> > http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4498426.html
> > Sent from the Maven - Users mailing list archive at
> Nabble.com.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to bind ant to a maven-plugin custom goal

Posted by Stephen Connolly <st...@gmail.com>.
create a maven plugin using the ANT bindings

http://maven.apache.org/plugin-tools/maven-plugin-tools-ant/index.html

I can't find the example for an ANT based plugin at the moment... should be
more promenant though

On 17 June 2011 12:10, Markos Charatzas <cu...@gmail.com> wrote:

> The way to integrate maven with ant is to simply use the
> maven-antrun-plugin
> like
>
>
> <plugin>
>    <groupId>org.apache.maven.plugins</groupId>
>    <artifactId>maven-antrun-plugin</artifactId>
>    <version>1.6</version>
>    <executions>
>        <execution>
>            <id>package</id>
>            <phase>package</phase>
>            <configuration>
>                <tasks>
>        <ant antfile="build.xml" target="package" />
>      </tasks>
>    </configuration>
>            <goals>
>                <goal>run</goal>
>            </goals>
>        </execution>
>    </executions>
> </plugin>
>
>
> in your project's pom.xml file
>
> However I want to be able to have that associated build.xml script along
> with the execution configuration as part of a maven plugin that defines a
> custom packaging and a lifecycle.
>
> Is there a way to do that?
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/How-to-bind-ant-to-a-maven-plugin-custom-goal-tp4498426p4498426.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>