【问题标题】:ANT - regex in headfilterANT - 头过滤器中的正则表达式
【发布时间】:2013-02-22 07:48:19
【问题描述】:

首先,我对 ANT 很陌生,我对我面临的问题进行了很多研究,但没有取得任何成功。 我正在尝试获取 SVN 版本号。通过以下蚂蚁任务。我得到了修订号。但我想该修订号中有一个新行。当我将该数字附加到工件时,我看到了吗?在那。

<target name="revision-number" > <loadfile srcfile="${basedir}/projectName/.svn/entries" property="revision"> <filterchain> <headfilter lines="1" skip="3"/> </filterchain> </loadfile> <echo file="REVISION" message="${revision}"/> </target>

ZIP 逻辑在这里。

当我在 unix 终端中看到它显示的名称时 - projectName.12345?.tar.gz 并且在 winscp 中的名称是正确的 - projectName.12345.tar.gz

日志 [echo] 开始压缩 [tar] 构建 tar:/opt/maven/hudson/jobs/project/workspace/projectName.tar [gzip] 构建:/opt/maven/hudson/jobs/project/workspace/projectName.156308 [gzip] .tar.gz [echo] 停止 Zip

有两个[gzip]

使用 winscp 复制 .​​gz 文件时出现错误(错误代码 123) 所以我想剥离这条新线。

谢谢

【问题讨论】:

    标签: svn ant build


    【解决方案1】:

    您应该使用trimIgnoreBlankDeleteCharacters 过滤器来执行此操作。更多信息在这里:

    修剪:http://ant.apache.org/manual/Types/filterchain.html#trim

    忽略空白:http://ant.apache.org/manual/Types/filterchain.html#IgnoreBlank

    删除字符:http://ant.apache.org/manual/Types/filterchain.html#DeleteCharacters

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-19
      • 2016-09-02
      • 2012-12-10
      • 2018-01-11
      相关资源
      最近更新 更多