Eclipse 使用笔记

来源:互联网 发布:怎么彻底删除手机数据 编辑:程序博客网 时间:2024/06/07 13:59

常用快捷键

Ctrl + Shift + R 搜索文件
Ctrl + Shift + T 搜索类型
Ctrl + O 搜索成员
10 Eclipse Navigation Shortcuts Every Java Programmer Should Know

智能提示

Windows > Preferences > General > Keys > Content Assist
在此设置智能提示快捷键
Windows > Preferences > Java > Editor > Content Assist > Auto activation triggers for Java:
在此将智能提示弹出条件设置为 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.

在Workspace之间共享Eclipse的设置

拷贝${workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings。
How to share eclipse configuration over different workspaces

Unicode设置问题

Window > Preferences
在搜索栏键encoding缩小范围
General > Content types > Default encoding:
在这里对每一种内容类型都输入UTF-8然后点击Update
Unicode/UTF-8 in your Eclipse Java projects

设置代理服务器

Windows > Preferences > General > Network Connections

Maven插件与代理服务器

在使用代理服务器上网的情况下,Eclipse内置的Maven插件无法使用IE或者Eclipse的设置,此时需要在Maven的配置文件(settings.xml)中单独设置代理服务器。
Windows > Preferences > Maven > User Settings > User Settings (open file)
在这里确定配置文件settings.xml的位置,打开或新建此文件:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                      http://maven.apache.org/xsd/settings-1.0.0.xsd">  <localRepository/>  <interactiveMode/>  <usePluginRegistry/>  <offline/>  <pluginGroups/>  <servers/>  <mirrors/>  <proxies>    <proxy>      <id>myproxy</id>      <active>true</active>      <protocol>http</protocol>      <host>192.168.1.100</host>      <port>6666</port>      <username></username>      <password></password>      <nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>    </proxy>  </proxies>  <profiles/>  <activeProfiles/></settings>
Maven plugin not using eclipse's proxy settings
Can access maven repository from behind proxy, need help

设置字体

Windows > Preferences > General > Appearance > Color and Fonts > Basic > Text Font > Edit...
How can I change font size in Eclipse for Java text editors?

常用编辑设置

Windows > Preferences > General > Editors > Text Editors
将Tab替换成空格:Insert spaces for tabs
显示打印边界线:Show print margin
显示行号:Show line numbers

启动程序前自动保存

Windows > Preferences > Run/Debug > Launching > Save required dirty editors before launching > Always
Eclipse: Save files without asking when I click run
Windows > Preferences > Server > Launching > Save dirty editors before starting the server > Always

启动Web应用时不使用Eclipse内置浏览器而是打开IE,Chrome或Firefox

Windows > Preferences > General > Web Browser > Use exernal web browser > Firefox(Internet Explorer,Chrome)

延长Tomcat Server最大启动时间(缺省时间45秒太短)

双击Server打开属性页在Timeouts部分中修改设置
How can I disable the eclipse server startup timeout?

设置Tomcat Server端口

双击Server打开属性页在Ports > HTTP1.1部分中修改设置8080以外的端口号(如80, 180)

保存Java文件时自动整理import

Windows > Preferences > Java > Editor > Save Actions > Perform the selected actions on save > Organize imports
快捷键 Ctrl + Shift + O
Can you organize imports for an entire project in eclipse with a keystroke?

Lombok设置问题

使用Lombok,可以在Eclipse中为Java类自动生成getter和setter方法,大大提高开发效率。可以说Lombok是一个必不可少的Java开发包和Eclipse插件。
Lombok插件安装步骤:

  1. 启动lombok-<version>.jar
    使用控制台的话,启动命令为 java -jar lombok-<version>.jar
    注:OpenJDK可能无法启动lombok,必须用OracleJDK
    如果使用maven的话,该程序位于C:\Users\<user name>\.m2\repository\org\projectlombok\lombok\<version>
  2. 按下"specify location"按钮,指定Eclipse的位置
  3. 按下"Install / Update"按钮,安装lombok

插件Plugins

插件说明下载WindowBuilderSwing界面可视化开发插件下载页Spring Tool SuiteSpring技术相关插件
1.Spring配置文件编辑器
2.快速查找(quick search)功能(快捷键Ctrl + Shift + L)Eclipse MarketplaceJBoss ToolsJBoss技术相关插件
1.包含Hibernate Tools,可用于创建Hibernate逆向工程(ORM)Eclipse Marketplacee(fx)clipseJavaFX开发用插件
1.为fxml文件增加右键菜单:用Scene Builder打开
2.JavaFX的css编辑器下载页Eclipse Color Theme颜色主题插件Eclipse MarketplaceGradle IDEGradle插件Eclipse MarketplaceEclipse SubversiveSVN插件
1.Windows > Preferences > Team > SVN > SVN Client
下载,设置SVN客户端下载页Aptana StudioRuby on Rails下载页

去除Console窗口输出长度限制

Windows > Preferences > Run/Debug > Console > Limit console output
缺省情况下输出长度有80000字符的限制,将Limit console output的勾去掉即可无限制输出。
adjusting eclipse console size

粘贴字符串时自动加上转义字符\

Window > Preferences > Java > Editor > Typing > Escape text when pasting into a string literal
勾选Escape text when pasting into a string literal。
Raw Strings in Java - for regex in particular

Deployment Assembly配置文件的位置

.settings/org.eclipse.wst.common.component
可以在Navigator View中查看
In which file eclipse “deployment assembly” configurations are at?

无法使用Querydsl插件生成Q类

在Eclipse.ini中添加
-vm
C:\Program Files\Java\<version>\bin\javaw.exe
-vmargs
...
Eclipse issue with Maven build and JDK when generating Qclasses in Querydsl

 

0 0