You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Niranjan Deshpande <ni...@gmail.com> on 2008/06/05 17:37:23 UTC
Calling ant tasks from maven pom
I am trying to execute ant tasks from maven's pom as below.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<exec executable="AppWeb/src/main/scripts/generate.sh"
failonerror="true">
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
The generate.sh file has 10 xml files that i want to run as
ant -buildfile -filename
for the time being I am running the plugin as maven antrun:run, just to find
whether the .sh file is called or not. But i am geting this:
[INFO] [antrun:run]
[INFO] Executing tasks
[INFO] Executed tasks
I have added a ECHO in the .sh file, but i see none at the output
--
Regards,
Niranjan Deshpande
"Shut yourself from the world and create the reality you want"
Re: Calling ant tasks from maven pom
Posted by Niranjan Deshpande <ni...@gmail.com>.
Tim thanks
I am finally able to reach the ant build file. I have moved the
<configuration> back into the <exections> as said by you, as I want the
pluging to run when my code is compiled, and dont want to run it stand
alone.
but the problem is the plugin does not run when i say mvn install or mvn
compile.
I have <phase>generate-sources</phase> right now
the plugin does not run even if i change this to compile.
My ant task is this: it takes my application's the compiled class, uses the
ant's javadoc utility
to generate a .property file from the javadocs in the class.
Hpe you got this.
Please help me on how to run the task on its own when i say mvn install.
The plugin runs standalone only when I say mvn antrun:run
On 6/6/08, Tim Kettler <ti...@udo.edu> wrote:
>
> Niranjan Deshpande schrieb:
>
>> Tim i indeed wht u suggested
>> <tasks>
>> <ant antfile..../>
>> </tasks>
>>
>> but the build xmls just dont seem to to reached..
>>
>
> It's working for me with this test project:
>
> .
> |-- pom.xml
> `-- src
> `-- main
> |-- antscripts
> | |-- antscript1.xml
> | `-- antscript2.xml
> `-- java
>
>
> relevant snippet from pom.xml:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <id>hello-from-ant</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <tasks>
> <ant antfile="src/main/antscripts/antscript1.xml"
> target="printhello"/>
> <ant antfile="src/main/antscripts/antscript2.xml"
> target="printhello"/>
> </tasks>
> </configuration>
> </plugin>
>
>
> When invoking maven with a phase liek 'mvn package' tha ant tasks get
> executed during the spcified 'generate-sources' phase. And when invoking the
> antrun-plugin directly via 'mvn antrun:run' the scripts get called, too.
>
> As you see I used the default <configuration/> section outside of the
> <execution/>. If you don't need to invoke the ant scripts standalone, I
> would move the configuration back inside the defined execution.
>
> -Tim
>
> On Thu, Jun 5, 2008 at 6:53 PM, Tim Kettler <ti...@udo.edu> wrote:
>>
>> Hi, (again :-) )
>>>
>>> Niranjan Deshpande schrieb:
>>>
>>> I am trying to execute ant tasks from maven's pom as below.
>>>
>>>>
>>>> <plugin>
>>>>
>>>> <artifactId>maven-antrun-plugin</artifactId>
>>>>
>>>> <version>1.1</version>
>>>>
>>>> <executions>
>>>>
>>>> <execution>
>>>>
>>>> <phase>generate-sources</phase>
>>>>
>>>> <configuration>
>>>>
>>>> <tasks>
>>>>
>>>> <exec executable="AppWeb/src/main/scripts/generate.sh"
>>>>
>>>> failonerror="true">
>>>>
>>>> </exec>
>>>>
>>>> </tasks>
>>>>
>>>> </configuration>
>>>>
>>>> <goals>
>>>>
>>>> <goal>run</goal>
>>>>
>>>> </goals>
>>>>
>>>> </execution>
>>>>
>>>> </executions>
>>>>
>>>> </plugin>
>>>> The generate.sh file has 10 xml files that i want to run as
>>>> ant -buildfile -filename
>>>>
>>>> for the time being I am running the plugin as maven antrun:run, just to
>>>> find
>>>> whether the .sh file is called or not. But i am geting this:
>>>> [INFO] [antrun:run]
>>>> [INFO] Executing tasks
>>>> [INFO] Executed tasks
>>>>
>>>> I have added a ECHO in the .sh file, but i see none at the output
>>>>
>>>>
>>>> First to answer your concrete problem: When you call a plugin goal
>>> directly
>>> from the commandline it uses the common configuration under
>>> <plugin/><configuration/> as there may be more than one execution defined
>>> and there is no sane way to decide which ones configuration to use.
>>>
>>> Secondly, just to recap that I understood correctly what you are doing:
>>>
>>> You have a maven build from which you want to call a shell script which
>>> in
>>> turn triggers a few ant builds?!?
>>>
>>> Cant you just configure multiple calls of the <ant/> task [1] in your
>>> antrun-plugin configuration and throw away the shell script completely?
>>>
>>> -Tim
>>>
>>> [1] http://ant.apache.org/manual/CoreTasks/ant.html
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
--
Regards,
Niranjan Deshpande
"Shut yourself from the world and create the reality you want"
Re: Calling ant tasks from maven pom
Posted by Tim Kettler <ti...@udo.edu>.
Niranjan Deshpande schrieb:
> Tim i indeed wht u suggested
> <tasks>
> <ant antfile..../>
> </tasks>
>
> but the build xmls just dont seem to to reached..
It's working for me with this test project:
.
|-- pom.xml
`-- src
`-- main
|-- antscripts
| |-- antscript1.xml
| `-- antscript2.xml
`-- java
relevant snippet from pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>hello-from-ant</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<tasks>
<ant antfile="src/main/antscripts/antscript1.xml"
target="printhello"/>
<ant antfile="src/main/antscripts/antscript2.xml"
target="printhello"/>
</tasks>
</configuration>
</plugin>
When invoking maven with a phase liek 'mvn package' tha ant tasks get
executed during the spcified 'generate-sources' phase. And when invoking
the antrun-plugin directly via 'mvn antrun:run' the scripts get called, too.
As you see I used the default <configuration/> section outside of the
<execution/>. If you don't need to invoke the ant scripts standalone, I
would move the configuration back inside the defined execution.
-Tim
> On Thu, Jun 5, 2008 at 6:53 PM, Tim Kettler <ti...@udo.edu> wrote:
>
>> Hi, (again :-) )
>>
>> Niranjan Deshpande schrieb:
>>
>> I am trying to execute ant tasks from maven's pom as below.
>>>
>>> <plugin>
>>>
>>> <artifactId>maven-antrun-plugin</artifactId>
>>>
>>> <version>1.1</version>
>>>
>>> <executions>
>>>
>>> <execution>
>>>
>>> <phase>generate-sources</phase>
>>>
>>> <configuration>
>>>
>>> <tasks>
>>>
>>> <exec executable="AppWeb/src/main/scripts/generate.sh"
>>>
>>> failonerror="true">
>>>
>>> </exec>
>>>
>>> </tasks>
>>>
>>> </configuration>
>>>
>>> <goals>
>>>
>>> <goal>run</goal>
>>>
>>> </goals>
>>>
>>> </execution>
>>>
>>> </executions>
>>>
>>> </plugin>
>>> The generate.sh file has 10 xml files that i want to run as
>>> ant -buildfile -filename
>>>
>>> for the time being I am running the plugin as maven antrun:run, just to
>>> find
>>> whether the .sh file is called or not. But i am geting this:
>>> [INFO] [antrun:run]
>>> [INFO] Executing tasks
>>> [INFO] Executed tasks
>>>
>>> I have added a ECHO in the .sh file, but i see none at the output
>>>
>>>
>> First to answer your concrete problem: When you call a plugin goal directly
>> from the commandline it uses the common configuration under
>> <plugin/><configuration/> as there may be more than one execution defined
>> and there is no sane way to decide which ones configuration to use.
>>
>> Secondly, just to recap that I understood correctly what you are doing:
>>
>> You have a maven build from which you want to call a shell script which in
>> turn triggers a few ant builds?!?
>>
>> Cant you just configure multiple calls of the <ant/> task [1] in your
>> antrun-plugin configuration and throw away the shell script completely?
>>
>> -Tim
>>
>> [1] http://ant.apache.org/manual/CoreTasks/ant.html
>>
>> ---------------------------------------------------------------------
>> 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: Calling ant tasks from maven pom
Posted by Niranjan Deshpande <ni...@gmail.com>.
Tim i indeed wht u suggested
<tasks>
<ant antfile..../>
</tasks>
but the build xmls just dont seem to to reached..
On Thu, Jun 5, 2008 at 6:53 PM, Tim Kettler <ti...@udo.edu> wrote:
>
> Hi, (again :-) )
>
> Niranjan Deshpande schrieb:
>
> I am trying to execute ant tasks from maven's pom as below.
>>
>>
>> <plugin>
>>
>> <artifactId>maven-antrun-plugin</artifactId>
>>
>> <version>1.1</version>
>>
>> <executions>
>>
>> <execution>
>>
>> <phase>generate-sources</phase>
>>
>> <configuration>
>>
>> <tasks>
>>
>> <exec executable="AppWeb/src/main/scripts/generate.sh"
>>
>> failonerror="true">
>>
>> </exec>
>>
>> </tasks>
>>
>> </configuration>
>>
>> <goals>
>>
>> <goal>run</goal>
>>
>> </goals>
>>
>> </execution>
>>
>> </executions>
>>
>> </plugin>
>> The generate.sh file has 10 xml files that i want to run as
>> ant -buildfile -filename
>>
>> for the time being I am running the plugin as maven antrun:run, just to
>> find
>> whether the .sh file is called or not. But i am geting this:
>> [INFO] [antrun:run]
>> [INFO] Executing tasks
>> [INFO] Executed tasks
>>
>> I have added a ECHO in the .sh file, but i see none at the output
>>
>>
> First to answer your concrete problem: When you call a plugin goal directly
> from the commandline it uses the common configuration under
> <plugin/><configuration/> as there may be more than one execution defined
> and there is no sane way to decide which ones configuration to use.
>
> Secondly, just to recap that I understood correctly what you are doing:
>
> You have a maven build from which you want to call a shell script which in
> turn triggers a few ant builds?!?
>
> Cant you just configure multiple calls of the <ant/> task [1] in your
> antrun-plugin configuration and throw away the shell script completely?
>
> -Tim
>
> [1] http://ant.apache.org/manual/CoreTasks/ant.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Regards,
Niranjan Deshpande
"Shut yourself from the world and create the reality you want"
Re: Calling ant tasks from maven pom
Posted by Tim Kettler <ti...@udo.edu>.
Hi, (again :-) )
Niranjan Deshpande schrieb:
> I am trying to execute ant tasks from maven's pom as below.
>
>
> <plugin>
>
> <artifactId>maven-antrun-plugin</artifactId>
>
> <version>1.1</version>
>
> <executions>
>
> <execution>
>
> <phase>generate-sources</phase>
>
> <configuration>
>
> <tasks>
>
> <exec executable="AppWeb/src/main/scripts/generate.sh"
>
> failonerror="true">
>
> </exec>
>
> </tasks>
>
> </configuration>
>
> <goals>
>
> <goal>run</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
> The generate.sh file has 10 xml files that i want to run as
> ant -buildfile -filename
>
> for the time being I am running the plugin as maven antrun:run, just to find
> whether the .sh file is called or not. But i am geting this:
> [INFO] [antrun:run]
> [INFO] Executing tasks
> [INFO] Executed tasks
>
> I have added a ECHO in the .sh file, but i see none at the output
>
First to answer your concrete problem: When you call a plugin goal
directly from the commandline it uses the common configuration under
<plugin/><configuration/> as there may be more than one execution
defined and there is no sane way to decide which ones configuration to use.
Secondly, just to recap that I understood correctly what you are doing:
You have a maven build from which you want to call a shell script which
in turn triggers a few ant builds?!?
Cant you just configure multiple calls of the <ant/> task [1] in your
antrun-plugin configuration and throw away the shell script completely?
-Tim
[1] http://ant.apache.org/manual/CoreTasks/ant.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Calling ant tasks from maven pom
Posted by Niranjan Deshpande <ni...@gmail.com>.
I am trying to execute ant tasks from maven's pom as below.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<exec executable="AppWeb/src/main/scripts/generate.sh"
failonerror="true">
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
The generate.sh file has 10 xml files that i want to run as
ant -buildfile -filename
for the time being I am running the plugin as maven antrun:run, just to find
whether the .sh file is called or not. But i am geting this:
[INFO] [antrun:run]
[INFO] Executing tasks
[INFO] Executed tasks
I have added a ECHO in the .sh file, but i see none at the output
Re: Calling ant tasks from maven pom
Posted by Brett Porter <br...@apache.org>.
Niranjan,
I think you are looking for the users@maven.apache.org list.
Regards,
Brett
On 06/06/2008, at 1:37 AM, Niranjan Deshpande wrote:
> I am trying to execute ant tasks from maven's pom as below.
>
>
> <plugin>
>
> <artifactId>maven-antrun-plugin</artifactId>
>
> <version>1.1</version>
>
> <executions>
>
> <execution>
>
> <phase>generate-sources</phase>
>
> <configuration>
>
> <tasks>
>
> <exec executable="AppWeb/src/main/scripts/generate.sh"
>
> failonerror="true">
>
> </exec>
>
> </tasks>
>
> </configuration>
>
> <goals>
>
> <goal>run</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
> The generate.sh file has 10 xml files that i want to run as
> ant -buildfile -filename
>
> for the time being I am running the plugin as maven antrun:run, just
> to find
> whether the .sh file is called or not. But i am geting this:
> [INFO] [antrun:run]
> [INFO] Executing tasks
> [INFO] Executed tasks
>
> I have added a ECHO in the .sh file, but i see none at the output
>
>
>
>
> --
> Regards,
> Niranjan Deshpande
>
> "Shut yourself from the world and create the reality you want"
--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org