lazybones
lazybones copied to clipboard
The String Literal "\n" gets transformed into a new line.
I have out.write("\n");
in a template file. When creating a new project from this template. The out.write("\n");
is changed to
out.write("
");
This is just one of those things when using the default Groovy template engine. You need to escape any $
and \
in the template. I'll keep this open as a documentation issue.
In your particular case, you can either use out.write("\\n")
or switch to Handlebars JavaScript templates, which don't have the same requirement. I lean towards using Handlebars for templates of Java and Groovy source files.
Thanks, this makes a lot of sence. I've been doing replacements in files that have $, but switching the template engine seems a lot easier.