Skip to content

Eclipse

springside edited this page May 29, 2012 · 26 revisions

##设置 每次新装Eclipse,都要设半天......

1.调整宽度到120 Java->Code Style->Formatter, 基于Eclipse-Buildin new 一个出来,设置Line Wrapping XML->XML Files Editor

2.Enable Save Action 自动格式化代码和整理Import Java -> Editor -> Save Actions

3.设置智能内容辅助的热键

因为默认的热键与输入法切换的热键冲突,所以需要修改General->Keys, 找到Content Assist,个人喜欢改为Shift + Space。

4.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函数时有用.

5.XML,XML->XML Files->Validation取消掉必须有DTD的检查.

6.设置使用JDK 而不是 JRE, Java->Install JREs.

7.设置Package Explorer展现,Link with Editor,View Menu->Package presentation->Hierarchical.

8.设置Console, 取消Limit Console Output.

##插件

新版Eclipse的Eclipse Markets太好用了。下载插件终于不是件太麻烦的事情,知道插件的名字,直接搜索然后安装就是了。

1.SpringIDE,其实用途只是看application*.xml 文件时,写错类名会有提示,点中Class名会跳到相应的实现类。

2.EasyShell,在Eclipse左边的目录管理树里选easyshell,就可以打开文件夹,或者打开该目录下的dos shell。

3.M2Eclipse,其实用途只是看依赖包之间的依赖关系。

##运行调试Web应用。 Eclipse的Web应用runtime插件一般都需要复制整个Web Application内容到一个它的某个目录才能启动,而且对依赖项目的打包经常出问题。因此SpringSide选了用嵌入式的Jetty来就地启动。

仿照在每个示例项目的test目录里的XXXXServer.java,复制一个到自己项目的测试目录,然后指定项目webapp目录路径,端口即可。

返回参考手册