如何更改 Eclipse 中生成的 Javadocs 模板?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2612633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I change the Javadocs template generated in Eclipse?
提问by Olaseni
I dislike the default Javadocs generated for me when I create a Class or methods, especially the @author variable, which is the current system username on my windows box.
我不喜欢在创建类或方法时为我生成的默认 Javadoc,尤其是 @author 变量,它是我的 windows 框上的当前系统用户名。
I would like to change it. Is this possible?
我想改变它。这可能吗?
采纳答案by VonC
Check Preferences / Java / Code Style / Code Template
查看 Preferences / Java / Code Style / Code Template
Section Comment / Type
部分 Comment / Type
You can replace the author
tag by whatever value you need and it will have an effect on new generated classes.
你可以用author
你需要的任何值替换标签,它会对新生成的类产生影响。
However, if the template is fine, but the value referenced buy the author tag is not, see this SO question:
但是,如果模板很好,但引用的值购买作者标签不是,请参阅此问题:
${user}
uses the value of the user.name
environment variable; therefore, you can pass -Duser.name=My Name
in eclipse.ini
to override it.
${user}
使用user.name
环境变量的值;因此,你可以通过-Duser.name=My Name
在eclipse.ini
覆盖它。
Or, if you prefer, you can modify the shortcut to point to:
或者,如果您愿意,可以修改快捷方式以指向:
C:/java/eclipse/eclipse.exe -vmargs -Duser.name="cleverUserNameToUseInSourceCode"
- MacOs: Aram Kocharyanmentionsthe
eclipse.ini
is inEclipse.app/Contents/MacOS/
if you right click and go Show Package Content. - ZendStudio: roffloxcommentsthe file is named
ZendStudio.ini
and is found inApplications/Zend Studio.app/Contents/MacOS/
.
回答by Binil Thomas
Look at Window -> Preferences -> Java -> Editor -> Templates.
查看窗口 -> 首选项 -> Java -> 编辑器 -> 模板。
回答by Julien
回答by Alexey Slepov
Spring Tool Suite (popular Eclipse customization for Spring development) uses STS.ini. On Windows I found it in the same dir as an app launch executable.
Spring Tool Suite(用于 Spring 开发的流行 Eclipse 定制)使用 STS.ini。在 Windows 上,我发现它与应用程序启动可执行文件位于同一目录中。