We need to echo some fairly long strings, and the ant-script would look better with the lines wrapped.
<echo file="my.log">Really loooong line, that needs to appear without line breaks in the output, but which I'd still like to wrap in the ant-script</echo>
In general line-wrapping in XML is up to the application -- so my question is specific to the ant-application. Can I add line-breaks somehow to the above example, yet still have each line appear unbroken in the output?
(Escaping the newlines with the backslash (\
) does not work...)
Put the string in a property, line-broken as you see fit, then use that property in the echo task.
Something like this:
<property name="string" value="Really loooong line,
that needs to appear without line breaks in the output,
but which I'd still like to wrap in the ant-script." />
<echo>${string}</echo>
Produces this output:
[echo] Really loooong line, that needs to appear without line breaks in the output, but which I'd still like to wrap in the ant-script.
As opposed to:
<echo>Really loooong line,
that needs to appear without line breaks in the output,
but which I'd still like to wrap in the ant-script.</echo>
Which produces
[echo] Really loooong line,
[echo] that needs to appear without line breaks in the output,
[echo] but which I'd still like to wrap in the ant-script.
Or put the string in the message parameters instead, which also works:
<echo message="Really loooong line,
that needs to appear without line breaks in the output,
but which I'd still like to wrap in the ant-script." />