使用 Ant 回显一行 SvnAnt 错误消息 [英] Echo a single line of an SvnAnt error message using Ant

查看:27
本文介绍了使用 Ant 回显一行 SvnAnt 错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果 SvnAnt 有错误,Ant 任务将在控制台上显示所有错误.

If the SvnAnt <export> has an error, the Ant <loadfile> task will show all of it on the console.

<svn refid="svn.settings" logFile="C:/Logfile.log">
    <export destpath="LOCAL Location" srcUrl="Source Url" />
</svn>
<loadfile property="svnLog" srcFile="C:/Logfile.log"/>
<echo>${svnLog}</echo>

[echo] <Export> started ...
[echo] export --no-auth-cache -r HEAD https://lbsm8-svn.path.local/svn/DB_Scripts/SCRIPTS/Reporting/FTR/ORAX/ftr1241000000430105_orax.pbd D:\Copyof\anttt\RET\ORA
[echo] svn: E170000: URL'https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-rng'
[echo] <Export> failed.
[echo] the execution failed for some reason. cause: Can't export
[echo]  at org.tigris.subversion.svnant.commands.SvnCommand.ex(Unknown Source)
[echo]  at org.tigris.subversion.svnant.commands.Export.execute(Unknown Source)
[echo]  at org.tigris.subversion.svnant.commands.SvnCommand.executeCommand(Unknown Source)
[echo]  at org.tigris.subversion.svnant.SvnTask.executeImpl(Unknown Source)
[echo]  at org.tigris.subversion.svnant.SvnTask.execute(Unknown Source)
[echo]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

我可以只显示日志文件中的这一点而忽略其余部分吗?

Can I only show this from the logfile and disregard the rest?

[echo] svn: E170000: URL'https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-rng'

推荐答案

FilterChain 可以给 以从文件中提取您想要的行:

The <linecontains> FilterChain can be given to <loadfile> to extract just the line you want from the file:

<loadfile property="svnLog" srcFile="C:/Logfile.log">
    <filterchain>
        <linecontains>
            <contains value="svn: E170000:"/>
        </linecontains>
    </filterchain>
</loadfile>
<echo>${svnLog}</echo>

输出

[echo] svn: E170000: URL'https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-rng'

这篇关于使用 Ant 回显一行 SvnAnt 错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆