开发者

Ant propertyfile replacing value issue

I'm trying to change values in my application.properties file and I'm running into issues with an extra "\" character when trying to substitute url addresses. It doesn't happen when I'm replacing regular text.

Here's the section of the properties file I'm attempting to modify:

# Web Info
web.url=http://www.testaddress.com
web.user=TestAccount

Here's the section of my script that's not working correctly:

<propertyfile file="applic开发者_运维知识库ation.properties">
  <entry key="web.url" operation="=" value="${webaddress}" />
  <entry key="web.user" operation="=" value="${username}" />
</propertyfile>

What happens is that the web.user is replaced just fine but the address comes out looking like so:

# Web Info
web.url=http\://www.realaddress.com
web.user=RealAccount

I can't account for the backslash, if I echo the ${webaddress} variable it doesn't have it. Any idea as to what may be going on?

Thanks.


Check out the "store" method of the Properties object. The javadoc specifically states:

The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜