gpt4 book ai didi

java - 使用 Ant 回显 SvnAnt 错误消息的单行

转载 作者:行者123 更新时间:2023-12-02 13:40:51 27 4
gpt4 key购买 nike

如果 SvnAnt <export>有错误,Ant <loadfile>任务将在控制台上显示所有内容。

<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)

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

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

最佳答案

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

<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'

关于java - 使用 Ant 回显 SvnAnt 错误消息的单行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42746637/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com