Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven archetype strips comments

I'm using Maven to generate an archetype. I'm able to get the archetype to generate fine and the project template it generates works as expected. The only problem is in my shell scripts. Anything commented out in the script gets stripped leaving behind only commands. I've searched high and low and all I've been able to find was another user facing a similar issue with java comments. https://stackoverflow.com/questions/18797333/maven-archetype-generation-is-stripping-java-comments That question remains unanswered, so I figure I'll ask again. Does anyone know why Maven archetypes strip comments or how to prevent this from happening?

like image 673
kbrian187 Avatar asked May 29 '14 13:05

kbrian187


2 Answers

Using the #set command itself to set a #hash variable equal to "#" worked, allowing me to maintain shell comments in scripts generated by the archetype. This can get relatively ugly when using 80 # symbols in a row in a header, but that's another matter...

like image 68
kbrian187 Avatar answered Oct 19 '22 16:10

kbrian187


I also had a similar problem with hashes. On page http://johnjianfang.blogspot.com/2009/03/escape-properties-in-maven-archetypes.html I found answer.

Something like this works fine in my case:

#set($hash = '#')
${hash}

Output:

#
like image 41
K. Gol Avatar answered Oct 19 '22 18:10

K. Gol