蚂蚁替换任务-Windows vs Mac
我正在尝试使用ANT的替换任务来修改XHTML文件,但是在MacOS上构建时遇到了问题。我已经通过以下最小设置复制了问题。
我有以下测试文本文件
<div>
<p>replace this</p>
</div>
和以下build.xml文件,
<?xml version="1.0" encoding="UTF-8"?>
<project name="test.ant.replace" default="main">
<target name="main">
<replace file="test.txt">
<replacetoken><![CDATA[<div>
<p>replace this</p>
</div>]]></replacetoken>
<replacevalue><![CDATA[<div>
<p>with this</p>
</div>]]></replacevalue>
</replace>
</target>
</project>
将测试文件格式为CRLF。 这是从提供的zip文件中解开包装的,因此我想以提供的格式保存)。
- (实际上, 替换发生。
- 当我在MacOS上运行示例时,它会做到 不是。
- 如果我将测试文件格式更改为LF,则可以在MacOS上使用 但不在窗户上。
为了允许两个平台上的开发人员运行构建,这意味着我无法通过FIXCRLF任务更改输入测试文件的线路结尾。
q。如何将我的替换任务的替换值更改为在两个平台上工作?
I'm trying to use Ant's replace task to modify an xhtml file but am having a problem when building on MacOS. I have replicated the issue with the following minimal setup.
I have the following test text file
<div>
<p>replace this</p>
</div>
and the following build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project name="test.ant.replace" default="main">
<target name="main">
<replace file="test.txt">
<replacetoken><![CDATA[<div>
<p>replace this</p>
</div>]]></replacetoken>
<replacevalue><![CDATA[<div>
<p>with this</p>
</div>]]></replacevalue>
</replace>
</target>
</project>
The test file is formatted as CRLF. (In practice this is unpacked from a provided zip file so I'd like to keep it in the provided format)
- When I run the example using
ant -v
on Windows, the build works and
the replacement takes place. - When I run the example on MacOS it does
not. - If I change the test file format to LF, then it works on MacOS
but not on Windows.
To allow developers on both platforms to run the build this implies I can't change the input test file's line endings via the FixCRLF task.
Q. How can I change my replace task's replacetoken value to work on both platforms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论