在Ant <exec> task </exec>的输出中更改[exec]标签

时间:2011-05-25 18:40:56

标签: ant exec parallel-processing echo

我正在使用Ant的<parallel>任务来执行使用<exec>任务的多个同时目标,但由于它是交错的,因此难以读取输出。有没有办法更改每行输出前出现的[exec]标签以使用命令或目标名称?

例如,在运行pdependphpcpd时,我想将[exec]更改为[pdepend][phpcpd]

pdepend:
    [exec] PHP_Depend 0.10.5 by Manuel Pichler
    [exec] 

phpcpd:
    [exec] Parsing source files:
    [exec] phpcpd 1.3.2 by Sebastian Bergmann.
    [exec] 
    [exec] ............................................................    60
    [exec] Found 26 exact clones with 640 duplicated lines in 28 files:
    [exec] 
    [exec]   - application/modules/controllers/IndexController.php:16-31
    [exec] ............................................................   120
    [exec]     application/modules/controllers/ErrorController.php:15-30
    [exec] 
    [exec]   - application/modules/controllers/PhotosController.php:24-33
    [exec] ............................................................   180
    [exec] ............................................................   240

变为

pdepend:
 [pdepend] PHP_Depend 0.10.5 by Manuel Pichler
 [pdepend] 

phpcpd:
  [phpcpd] Parsing source files:
  [phpcpd] phpcpd 1.3.2 by Sebastian Bergmann.
  [phpcpd] 
 [pdepend] ............................................................    60
  [phpcpd] Found 26 exact clones with 640 duplicated lines in 28 files:
  [phpcpd] 
  [phpcpd]   - application/modules/controllers/IndexController.php:16-31
 [pdepend] ............................................................   120
  [phpcpd]     application/modules/controllers/ErrorController.php:15-30
  [phpcpd] 
  [phpcpd]   - application/modules/controllers/PhotosController.php:24-33
 [pdepend] ............................................................   180
 [pdepend] ............................................................   240

1 个答案:

答案 0 :(得分:10)

您是否尝试在taskname任务上设置exec属性?我会在几个小时内仔细检查并确认。

<强>更新 是的,taskname可以解决问题。如,

<exec executable="phpcpd" taskname="phpcpd">
    ...
</exec>

来自Common Attributes of all Tasks

  

taskname:此任务实例的其他名称 - 将显示在日志记录输出中。