Maven原型剥离评论 [英] Maven archetype strips comments

查看:98
本文介绍了Maven原型剥离评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Maven生成原型.我能够使原型生成良好,并且生成的项目模板可以按预期工作.唯一的问题是在我的shell脚本中.脚本中注释掉的所有内容都将被剥离,仅留下命令.我已经搜索了很多东西,而我所能找到的只是另一个面临类似Java注释问题的用户. https://stackoverflow.com/questions/18797333/maven-archetype-generation- is-stripping-java-comments 这个问题仍然没有答案,所以我想再问一次.有谁知道为什么Maven原型会删除注释或如何防止这种情况发生?

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?

推荐答案

使用#set命令本身将#hash变量设置为等于#"是可行的,这使我可以在原型生成的脚本中维护shell注释.在标头中连续使用80#个符号时,这可能会相对难看,但这是另一回事...

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...

这篇关于Maven原型剥离评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆