Eclipse开发环境设置

必选设置
1. General - Appearance - Colors and Fonts 设置字体为Consolas 10号,脚本为中欧字符
General - Editors - Text Editors - Hyperlinking 将超链接的默认键改为Alt
General - Editors - Text Editors - Spelling 禁用拼写检查
General - Startup and Shutdown 全部禁用
General - Workspace 禁用自动编译,Text file encoding改为UTF-8
2. Javascript - Editor - Mark occurrences去掉Mark occurrences of the selected element in the current file前面的勾
3. Validation Build一列除 Classpath dependency validator外别的全部勾掉
4. Java - Editor - Hovers 禁用Combined Hover
5. Enable Save Action ,勾选自动格式化代码和整理Import
Java -> Editor -> Save Actions
6.设置智能内容辅助的热键
因为默认的热键原来是Ctrl+Space与输入法切换的热键冲突,Eclipse Juno默认为Alt+/,修改方法为General->Keys, 找到Content Assist,个人喜欢多加一个Shift + Space。
7.(手工)设置使用JDK 而不是 JRE, Java->Install JREs,选择JDK的目录为默认,否则看不到JDK自己的源码,而且Jetty编译JSP失败.

可选设置
1.调整Java和XML的宽度到120
Java->Code Style->Formatter, 基于Eclipse-Buildin new 一个出来,设置Line Wrapping 和 Comments里的Line Width。
同时修改XML->XML Files->Editor。

2.设置JavaDoc格式 依然是Java->Code Style->Formatter,在new出来的profile中,Comments里, 勾选Never Join lines,取消 New Line after @param tags

3.import static org.junit.Assert.* 不会被解开成import static org.junit.Assert.Equal
修改Java->Code Style->Organize Import, 设置Number of static imports needed of * to 1.
单元测试中不愿意写Assert.equals()/Assert.isTrue(), 又不想一个个的import所有可能用到的assert函数时有用.

4.设置Actions
Java -> Code Style -> Clean Up中新建一个profile,在Code Style中勾选Use Blocks in if/while,钩选Convert For Loop to enhanced,钩选Use parenthese,取消Use Final Modifer where posibble。

5.设置代码Warning Java-> Compiler -> Errors/Warning
§ Code Style,选Parameter Assignment/Undocument empty block
§ Potential programming problems,选Possible boolean assignment/Empty Statement/Unused object alllocation/ Switch case fall through/ Missing synchronizied modifier on inherited method / Class override equals not hashcode
§ Name shadowing and conflicts, 全选剩下的两项。
§ Unnessary Code, 选Value of parameter is not use / Unnecessary cast or instanceof
§ Generic Type,全部取消。
§ Null analysis, 选potential null access/redudant null check

6.XML取消掉必须有DTD的warning,XML->XML Files->Validation,将No gammer specied改为Ignore.

7.(手工)设置Package Explorer展现,View Menu->Package presentation->Hierarchical.

8.(手工)设置Console, 取消Limit Console Output.

9.(手工)设置右下方的窗口,将用不上的窗口关掉,如properties, database exporler, snippets等。


项目中,SVN通过每个文件夹下隐藏的.svn文件夹来进行版本控制。

Eclipse的源码文件夹src自然需要svn控制,而eclipse开启自动编译的话,默认src下的所以文件及文件夹都会被编译到classes文件夹中去,这时候.svn文件夹也被copy到了classes文件夹中。

而这个.svn文件夹保存的是src版本信息而非classes版本信息,.svn被克隆了, 在classes进行svn提交发现提示所有的.java源码missing,如果提交了,相当于在src删除了所有的源码文件。

这个缺陷对不知道情况的人会比较严重。解决方法就是修改eclipse的build path,排除掉.svn文件夹的自动编译。

右键项目名 -> 选择Build Path,选择Configure Build Path -> 选择Source,找到该项目下的Excluded项,编辑,添加排除规则: **/.svn/**

最后保存即可。

posted @ 2014-07-17 13:01  gowk  阅读(239)  评论(0)    收藏  举报