更改 Ant输出中的 [exec] 标签任务

发布于 2024-11-10 07:27:55 字数 1958 浏览 2 评论 0原文

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

例如,在运行 pdependphpcpd 时,我想将 [exec] 更改为 [pdepend] 和 < code>[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

I am using Ant's <parallel> task to perform multiple simultaneous targets that use <exec> tasks, but it's difficult to read the output because it is interleaved. Is there any way to change the [exec] label that appears before each line of output to use the command or target name?

For example, while running pdepend and phpcpd I would like to change [exec] to [pdepend] and [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

becomes

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终止放荡 2024-11-17 07:27:56

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

更新:
是的,taskname 就可以了。例如,

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

来自所有任务的通用属性

taskname:此任务实例的不同名称 - 将显示在日志输出中。

Have you tried setting the taskname attribute on the exec task? I'll double check in a couple of hours and confirm.

Update:
Yep, taskname does the trick. e.g.,

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

From Common Attributes of all Tasks:

taskname: A different name for this task instance - will show up in the logging output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文