3
在我的構建文件我有一個Ant目標中,我有下面的代碼片段,如何使用ant replaceregex任務在Windows中用文件路徑替換一行?
<replaceregexp replace="custom.dir=${basedir}/tasks/custom" byline="true" file="${basedir}/MyApp/configuration.properties">
<regexp pattern="custom.dir=(.*)"/>
</replaceregexp>
我想替換的路徑「custom.dir」屬性中的「configuration.properties」文件,然而,一旦我執行我的目標,我得到修改,以
custom.dir = C爲 「custom.dir」 屬性條目:arenaplaygroundmytestapp /任務/定製
,而不是
custom.dir = C:\競技場\操場\ mytestapp /任務/定製
我應該做的正確書寫與適當的文件分隔符的 「configuration.properties」 文件的路徑。我在窗戶和螞蟻使用的是螞蟻1.8。
感謝Vishal,作爲魅力。 – jay