开发者

How to put a newline in ant property

开发者 https://www.devze.com 2023-03-29 02:02 出处:网络
This doesn\'t seem to work: <property name=\"foo\" value=\"\\n bar \\n\"/> I use the property value in the body of an e-mail message (which is sent as plain text):

This doesn't seem to work:

<property name="foo" value="\n bar \n"/>

I use the property value in the body of an e-mail message (which is sent as plain text):

开发者_JAVA技巧
<mail ...>
  <message>some text${foo}</message>

and I get literal "\n" in the e-mail output.


These all work for me:

<property name="foo" value="bar${line.separator}bazz"/>

<property name="foo">bar
bazz2</property>

<property name="foo" value="bar&#10;bazz"/>


You want ${line.separator}. See this post for an example. Also, the Ant echo task manual page has an example using ${line.separator}.

By using ${line.separator} you're simply using a Java system property. You can read up on the list of system properties here, and here is Ant's manual page on Properties.

0

精彩评论

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