You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mario Madunic <Ma...@newflyer.com> on 2011/03/09 18:13:38 UTC

Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file

(Ant 1.8.2, XP SP3)

Background:
I’m using ANT to pipeline my conversion of XML (Excel) to PDF via the command line. So I chunked up the various steps into separate project files and import into the build.xml. At one point an XSLT created a bat file to copy required SVGs locally for use in the PDF. The bat file was executed using the <exec> task. A requirement came up to strip the DTD declaration out all the SVGs, so instead of creating a simple bat file to copy each SVG required it was changed to create a build file. In the build file are <copy> tasks and <filterchain> <tokenfilter> to strip out the DTD declaration. This ANT build does not exist as part of the main build.xml but executed within right after it has been created via XSLT. Hopefully that is clearer than mud.

So here is the unexpected or unusual (at least to me) behaviour. When the copy SVGs ANT build is executed and I hit ctrl C to stop the process to check the few files that have been copied over, the copy SVG build is still running in the background even though the main build.xml has been stopped. Is this behaviour correct and expected? I’m just curious more than anything and am not really looking for a solution. (To stop it copying I open the task manager and terminate the java task running.)

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries


________________________________
Please consider the environment before printing this e-mail.


CONFIDENTIALITY STATEMENT: This communication (and any and all information or material transmitted with this communication) is confidential, may be privileged and is intended only for the use of the intended recipient. If you are not the intended recipient, any review, retransmission, circulation, distribution, reproduction, conversion to hard copy, copying or other use of this communication, information or material is strictly prohibited and may be illegal. If you received this communication in error or if it is forwarded to you without the express authorization of New Flyer, please notify us immediately by telephone or by return email and permanently delete the communication, information and material from any computer, disk drive, diskette or other storage device or media. Thank you.

RE: Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file

Posted by Mario Madunic <Ma...@newflyer.com>.
Thanks Vimil,

That explains it quite clearly and will give the subant task a try.

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries


-----Original Message-----
From: Vimil Saju [mailto:vimilsaju@yahoo.com]
Sent: Wednesday, March 09, 2011 11:22 AM
To: Ant Users List
Subject: Re: Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file

The reason for the behavior is because the batch file runs in a separate process. To prevent this behavior, instead of executing the batch file from the main build.xml, you can directly invoke the generated build.xml from the main build.xml using the subant task. Doing this makes the generated build.xml run in the same process as the main build.xml.

Hope my explanation helps

--- On Wed, 3/9/11, Mario Madunic <Ma...@newflyer.com> wrote:

> From: Mario Madunic <Ma...@newflyer.com>
> Subject: Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file
> To: "user@ant.apache.org" <us...@ant.apache.org>
> Date: Wednesday, March 9, 2011, 9:13 AM
> (Ant 1.8.2, XP SP3)
>
> Background:
> I’m using ANT to pipeline my conversion of XML (Excel) to
> PDF via the command line. So I chunked up the various steps
> into separate project files and import into the build.xml.
> At one point an XSLT created a bat file to copy required
> SVGs locally for use in the PDF. The bat file was executed
> using the <exec> task. A requirement came up to strip
> the DTD declaration out all the SVGs, so instead of creating
> a simple bat file to copy each SVG required it was changed
> to create a build file. In the build file are <copy>
> tasks and <filterchain> <tokenfilter> to strip
> out the DTD declaration. This ANT build does not exist as
> part of the main build.xml but executed within right after
> it has been created via XSLT. Hopefully that is clearer than
> mud.
>
> So here is the unexpected or unusual (at least to me)
> behaviour. When the copy SVGs ANT build is executed and I
> hit ctrl C to stop the process to check the few files that
> have been copied over, the copy SVG build is still running
> in the background even though the main build.xml has been
> stopped. Is this behaviour correct and expected? I’m just
> curious more than anything and am not really looking for a
> solution. (To stop it copying I open the task manager and
> terminate the java task running.)
>
> Marijan (Mario) Madunic
> Publishing Specialist
> New Flyer Industries
>
>
> ________________________________
> Please consider the environment before printing this
> e-mail.
>
>
> CONFIDENTIALITY STATEMENT: This communication (and any and
> all information or material transmitted with this
> communication) is confidential, may be privileged and is
> intended only for the use of the intended recipient. If you
> are not the intended recipient, any review, retransmission,
> circulation, distribution, reproduction, conversion to hard
> copy, copying or other use of this communication,
> information or material is strictly prohibited and may be
> illegal. If you received this communication in error or if
> it is forwarded to you without the express authorization of
> New Flyer, please notify us immediately by telephone or by
> return email and permanently delete the communication,
> information and material from any computer, disk drive,
> diskette or other storage device or media. Thank you.
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Please consider the environment before printing this e-mail.


CONFIDENTIALITY STATEMENT: This communication (and any and all information or material transmitted with this communication) is confidential, may be privileged and is intended only for the use of the intended recipient. If you are not the intended recipient, any review, retransmission, circulation, distribution, reproduction, conversion to hard copy, copying or other use of this communication, information or material is strictly prohibited and may be illegal. If you received this communication in error or if it is forwarded to you without the express authorization of New Flyer, please notify us immediately by telephone or by return email and permanently delete the communication, information and material from any computer, disk drive, diskette or other storage device or media. Thank you.

Re: Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file

Posted by Vimil Saju <vi...@yahoo.com>.
The reason for the behavior is because the batch file runs in a separate process. To prevent this behavior, instead of executing the batch file from the main build.xml, you can directly invoke the generated build.xml from the main build.xml using the subant task. Doing this makes the generated build.xml run in the same process as the main build.xml. 

Hope my explanation helps

--- On Wed, 3/9/11, Mario Madunic <Ma...@newflyer.com> wrote:

> From: Mario Madunic <Ma...@newflyer.com>
> Subject: Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file
> To: "user@ant.apache.org" <us...@ant.apache.org>
> Date: Wednesday, March 9, 2011, 9:13 AM
> (Ant 1.8.2, XP SP3)
> 
> Background:
> I’m using ANT to pipeline my conversion of XML (Excel) to
> PDF via the command line. So I chunked up the various steps
> into separate project files and import into the build.xml.
> At one point an XSLT created a bat file to copy required
> SVGs locally for use in the PDF. The bat file was executed
> using the <exec> task. A requirement came up to strip
> the DTD declaration out all the SVGs, so instead of creating
> a simple bat file to copy each SVG required it was changed
> to create a build file. In the build file are <copy>
> tasks and <filterchain> <tokenfilter> to strip
> out the DTD declaration. This ANT build does not exist as
> part of the main build.xml but executed within right after
> it has been created via XSLT. Hopefully that is clearer than
> mud.
> 
> So here is the unexpected or unusual (at least to me)
> behaviour. When the copy SVGs ANT build is executed and I
> hit ctrl C to stop the process to check the few files that
> have been copied over, the copy SVG build is still running
> in the background even though the main build.xml has been
> stopped. Is this behaviour correct and expected? I’m just
> curious more than anything and am not really looking for a
> solution. (To stop it copying I open the task manager and
> terminate the java task running.)
> 
> Marijan (Mario) Madunic
> Publishing Specialist
> New Flyer Industries
> 
> 
> ________________________________
> Please consider the environment before printing this
> e-mail.
> 
> 
> CONFIDENTIALITY STATEMENT: This communication (and any and
> all information or material transmitted with this
> communication) is confidential, may be privileged and is
> intended only for the use of the intended recipient. If you
> are not the intended recipient, any review, retransmission,
> circulation, distribution, reproduction, conversion to hard
> copy, copying or other use of this communication,
> information or material is strictly prohibited and may be
> illegal. If you received this communication in error or if
> it is forwarded to you without the express authorization of
> New Flyer, please notify us immediately by telephone or by
> return email and permanently delete the communication,
> information and material from any computer, disk drive,
> diskette or other storage device or media. Thank you.
> 


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org