---
title: "eclipse 常用设置"
author: "fly533"
date: "2018-08-08T11:13:04Z"
tags: []
categories: ["非技术"]
slug: "eclipse"
draft: false
lastmod: "2018-08-08T11:17:32Z"
id: 2428303
url: "https://fly533.iteye.com/blog/2428303"
---

**写好代码需要个好的工具辅助，eclipse完整设置。让你事半功倍！**
**以下截图为eclipse-photon版本。**

**1、字体大小**
![](http://dl2.iteye.com/upload/attachment/0130/4139/41b660d4-e69e-3989-bff1-a9f62f78824c.png)
  详细步骤参考文章： https://www.cnblogs.com/xiezhidong/p/6048256.html

**2、tab转空格**
Windows->Preferences->General->Editors->Text Editors，选中“Insert spaces for tabs”。

另外需要针对java文件设置一次：
window->preference-左侧菜单：Java -> Code Style -> Formatter，
然后点击Active profile中的Edit按钮， Tab policy 右边的下拉框，选择Space only
然后下面的Indentation size 和 Tab size 都设置成你要的空格数即可！一般是4个空格

![](http://dl2.iteye.com/upload/attachment/0130/4141/85cf750a-d523-30a9-a349-a33541ac9fc6.png)
**3、自动换行字数**
    Preferences->Java->Code Style->Formatter->Edit ->Line Wrapping->Maximum line width:默认80 修改成120就行了。

**4、默认utf-8**
    a、windows->Preferences->general->Workspace，右侧Text file encoding，选择Other，改变为UTF-8，以后新建立工程其属性对话框中的Text file encoding即为UTF-8。
    b、windows->Preferences...打开"首选项"对话框，左侧导航树，导航到general->Content Types，右侧Context Types树，点开Text中每一个子项,并将其编码设置为"UTF-8",点update!
其他java应用开发相关的文件如：properties、XML等已经由Eclipse缺省指定，分别为ISO8859-1，UTF-8，如开发中确需改变编码格式则可以在此指定。

**5 、maven设置**
    一般需要设置自己的setting.xml,在setting.xml中指定公司的私服、并设置repository的目录（默认是C盘当前用户目录下）
![](http://dl2.iteye.com/upload/attachment/0130/4143/53e0fc6a-a431-3726-9f99-57eff1c7cf82.png)

setting.xml文件下载<http://dl.iteye.com/topics/download/e384f6d0-7f11-3669-af9b-11c8365d7353>

**6、jetty插件**
    一般web工程在eclipse中启动时，需要指定额外的tomcat来启动，比较繁琐。使用jetty插件启动更方便。不过现在更多的项目使用springboot搭建，这里就不详细说明安装及使用。
![](http://dl2.iteye.com/upload/attachment/0130/4145/62b5e52e-44ed-3bfe-9bd7-8a51ab57fe78.png)
使用参考文章：https://www.cnblogs.com/Fairy-02-11/p/6186918.html

**7、切换为unix下的换行符**
   Windows->Preferences->General->Workspace -> New text file line delimiter 选中Unix
    https://blog.csdn.net/ljgstudy/article/details/25542279

**8、阿里java代码规范插件——强力推荐**
    插件地址： https://p3c.alibaba.com/plugin/eclipse/update
    https://blog.csdn.net/qq_34359363/article/details/78284187

**9、指定jdk启动**（部分高版本eclipse不支持低版本jdk）
     打开eclipse安装目录下的eclipse.ini
     添加参数：
        -vm
       C:\Program Files\Java\jdk1.7.0_80\bin

11、js、html插件
         aptana-3 ？
         Spket ？

12、js debug  ？

13、 svn忽略target 文件夹 *.settings  .classpath  .project等文件
   在eclipse中,Windows -> Preferences -> Team -> Ignored Resources里点 “Add Pattern”。
   添加:target  *.settings  .classpath  .project ，然后再"运用"-->"确定",重新编译代码即可

**14、注释模板**
   https://blog.csdn.net/KunGe_/article/details/78215580?locationNum=9&fps=1
    注释模板下载<http://dl.iteye.com/topics/download/8a2d9c74-0e46-3d62-ab7c-5c7befabb00d>
    
    
**15 、适当的代码提示设置**
    https://jingyan.baidu.com/article/5553fa82a40d9865a3393469.html

**16、视情况安装svn插件**
       建议通过eclipse marketplace
   ![](http://dl2.iteye.com/upload/attachment/0130/4150/e48454ae-9612-34ae-b0ad-766f41dbc8e6.png)

**17、 安装STS 用于spring boot开发**
![](http://dl2.iteye.com/upload/attachment/0130/4147/0485db8f-72f7-3fa9-a0f8-ff9df651da5a.png)


载自我的印象笔记<https://www.evernote.com/shard/s170/sh/e3c36682-794d-488f-b851-6775c3b72aac/e5ecda56f2db221d> ，可看到最新的改动。