如何更改 Eclipse 中生成的 Javadocs 模板? [英] How do I change the Javadocs template generated in Eclipse?
问题描述
我不喜欢在创建类或方法时为我生成的默认 Javadoc,尤其是 @author 变量,它是我的 windows 框上的当前系统用户名.
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.
我想改变它.这可能吗?
I would like to change it. Is this possible?
推荐答案
检查 Preferences/Java/Code Style/Code Template
部分注释/类型
你可以用你需要的任何值替换 author
标签,它会对新生成的类产生影响.
You can replace the author
tag by whatever value you need and it will have an effect on new generated classes.
但是,如果模板很好,但引用的值购买作者标签不是,请参阅此SO 问题:
However, if the template is fine, but the value referenced buy the author tag is not, see this SO question:
${user}
使用 user.name
环境变量的值;因此,您可以在 eclipse.ini
中传递 -Duser.name=My Name
来覆盖它.
${user}
uses the value of the user.name
environment variable; therefore, you can pass -Duser.name=My Name
in eclipse.ini
to override it.
或者,如果您愿意,可以修改指向的快捷方式:
Or, if you prefer, you can modify the shortcut to point to:
C:/java/eclipse/eclipse.exe -vmargs -Duser.name="cleverUserNameToUseInSourceCode"
<小时>
- MacOs:Aram Kocharyan 提到
eclipse.ini
在Eclipse.app/Contents/MacOS/
如果您右键单击并转到显示包内容". - ZendStudio:rofflox comments 该文件名为
ZendStudio.ini
并位于Applications/Zend Studio.app/Contents/MacOS/
. - MacOs: Aram Kocharyan mentions the
eclipse.ini
is inEclipse.app/Contents/MacOS/
if you right click and go Show Package Content. - ZendStudio: rofflox comments the file is named
ZendStudio.ini
and is found inApplications/Zend Studio.app/Contents/MacOS/
.
这篇关于如何更改 Eclipse 中生成的 Javadocs 模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!