How can I add a default header to my source files automatically in Eclipse?(如何在 Eclipse 中自动将默认标头添加到我的源文件?)
问题描述
我正在尝试弄清楚如何将注释标头自动添加到我的 eclipse java 项目中的所有新源文件中.我环顾四周,但我还没有找到一个简单的解决方案来自动化这个过程.我尝试了 JAutodoc,尽管它允许我指定一个标头,但我仍然必须手动告诉插件注入标头,而且它似乎不太喜欢我的关键字替换.
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.
如果有帮助的话,我会在我的大部分项目中使用 Eclipse 的 Maven2 插件.
I'm by the way using the Maven2 plugin for Eclipse for most of my projects if that's any help.
有什么建议吗?
推荐答案
评论生成配置在:
主菜单 -> 窗口 -> 首选项 -> Java -> 代码风格 -> 代码模板 -> 配置生成的代码和注释
Main Menu -> Window -> Preferences -> Java -> Code Style -> Code Templates -> Configure generated code and comments
您可以直接更改 New Java files 模板:代码 -> 新建 Java 文件 -> 编辑
You can change directly the New Java files template: Code -> New Java files -> Edit
从 Eclipse 3.6 版本开始,已配置为插入新的 Java 文件 ${filecomment},因此最好改为编辑它:
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:
评论 -> 文件 -> 编辑
这篇关于如何在 Eclipse 中自动将默认标头添加到我的源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Eclipse 中自动将默认标头添加到我的源文件?
基础教程推荐
- 存储 20 位数字的数据类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
