Re: Calling ant tasks from maven pom

2008-06-06 Thread Tim Kettler

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
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
executions
  execution
idhello-from-ant/id
phasegenerate-sources/phase
goals
  goalrun/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 [EMAIL PROTECTED] wrote:


Hi, (again :-) )

Niranjan Deshpande schrieb:

 I am trying to execute ant tasks from maven's pom as below.


plugin

artifactIdmaven-antrun-plugin/artifactId

version1.1/version

executions

execution

phasegenerate-sources/phase

configuration

tasks

exec executable=AppWeb/src/main/scripts/generate.sh

failonerror=true

/exec

/tasks

/configuration

goals

goalrun/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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








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



Re: Calling ant tasks from maven pom

2008-06-06 Thread Niranjan Deshpande
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  phasegenerate-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 [EMAIL PROTECTED] 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
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
executions
  execution
idhello-from-ant/id
phasegenerate-sources/phase
goals
  goalrun/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 [EMAIL PROTECTED] wrote:

 Hi, (again :-) )

 Niranjan Deshpande schrieb:

  I am trying to execute ant tasks from maven's pom as below.


 plugin

 artifactIdmaven-antrun-plugin/artifactId

 version1.1/version

 executions

 execution

 phasegenerate-sources/phase

 configuration

 tasks

 exec executable=AppWeb/src/main/scripts/generate.sh

 failonerror=true

 /exec

 /tasks

 /configuration

 goals

 goalrun/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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






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




-- 
Regards,
Niranjan Deshpande

Shut yourself from the world and create the reality you want


Re: Calling ant tasks from maven pom

2008-06-05 Thread Tim Kettler


Hi, (again :-) )

Niranjan Deshpande schrieb:

 I am trying to execute ant tasks from maven's pom as below.


plugin

artifactIdmaven-antrun-plugin/artifactId

version1.1/version

executions

execution

phasegenerate-sources/phase

configuration

tasks

exec executable=AppWeb/src/main/scripts/generate.sh

failonerror=true

/exec

/tasks

/configuration

goals

goalrun/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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Calling ant tasks from maven pom

2008-06-05 Thread Niranjan Deshpande
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 [EMAIL PROTECTED] wrote:


 Hi, (again :-) )

 Niranjan Deshpande schrieb:

  I am trying to execute ant tasks from maven's pom as below.


 plugin

 artifactIdmaven-antrun-plugin/artifactId

 version1.1/version

 executions

 execution

 phasegenerate-sources/phase

 configuration

 tasks

 exec executable=AppWeb/src/main/scripts/generate.sh

 failonerror=true

 /exec

 /tasks

 /configuration

 goals

 goalrun/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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Regards,
Niranjan Deshpande

Shut yourself from the world and create the reality you want