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

查看:18
本文介绍了如何在 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 中自动将默认标头添加到我的源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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