如何在Eclipse中自动为源文件添加默认标题? [英] How can I add a default header to my source files automatically in Eclipse?

查看:141
本文介绍了如何在Eclipse中自动为源文件添加默认标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚我如何将一个注释头自动添加到我的eclipse java项目中的所有新的源文件。我已经环顾四周,但我还没有找到一个简单的解决方案来自动化这个过程。我给了JAutodoc一个尝试,尽管它允许我指定一个标题,但我仍然不得不手动告诉插件来插入标题,并且它似乎不喜欢我的关键字归属。



我正在使用Maven2插件为Eclipse的大部分项目,如果有任何帮助。



任何提示? p>

解决方案

注释生成配置在:



主菜单 - > 窗口 - > 偏好设置 - > Java - > 代码样式模板 - > 配置生成的代码和注释



您可以直接更改新的Java文件模板:
代码 - > 新的Java文件 - > 修改



截至Eclipse 3.6版本已经被配置为插入新的Java文件 $ {filecomment} ,所以它可能更好修改:



评论 - > 文件 - > p>

I'm trying to figure out how I can have a comment header automatically added to all new source files in my eclipse java project. I've looked around but I haven't found a simple solution to automate this process. I gave JAutodoc a try, and even though it does allow me to specify a header I still had to tell the plugin manually to inject the header and it didn't seem very fond of my keyword-subsitution.

I'm by the way using the Maven2 plugin for Eclipse for most of my projects if that's any help.

Any tips?

解决方案

Comments generation is configured in:

Main Menu -> Window -> Preferences -> Java -> Code Style -> Code Templates -> Configure generated code and comments

You can change directly the New Java files template: Code -> New Java files -> Edit

As of Eclipse 3.6 version, it is already configured that for new Java files ${filecomment} is inserted, so it is probably better to edit it instead:

Comments -> Files -> Edit

这篇关于如何在Eclipse中自动为源文件添加默认标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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