eclipse创建新的工作空间导入项目配置环境并启动过程记录

一、创建新的工作空间(略)

二、导入项目

  导入maven项目:File-->Import-->Maven-->Existing Maven Projects-->Next-->Browse-->找到项目路径-->选择文件夹-->Finish(我是已经导入后重新截图的,显示已经导入了,正常是pom.xml文件前的复选框打勾状态的)

 

三、开发环境配置

   1.设置字体:Window-->Preferences-->General-->Appearance-->Colors and Fonts-->Basic-->Text Font-->Edit-->Apply-->Apply and Close

   2.设置编码(工作空间的默认编码格式,项目中的默认编码格式,配置文件.properties的编码格式,jsp文件的编码格式)

    2.1工作空间编码设置:Window-->Preferences-->General-->Workspace-->Text file encoding-->Other:UTF-8-->Apply-->Apply and Close

     2.2properties文件编码设置:Window-->Preferences-->General-->Content Types-->Text-->Java Properties File-->Default encoding:UTF-8-->Update-->Apply and Close

     2.3项目编码设置:项目右击-->Preferences-->Text file encoding-->Other:UTF-8-->Apply-->Apply and Close

    2.4jsp文件编码设置:Window-->Preferences-->Web-->JSP Files-->Encoding:UTF-8-->Apply-->Apply and Close

  3.jdk配置:Window-->Preferences-->Java-->Installed JREs-->Add-->Standard VM-->Next-->Directory-->选择自己需要的jdk版本-->Finish--Apply-->Apply and Close

 

 

 

     jdk编译器要和jdk版本一致:Window-->Preferences-->Java-->Compiler-->Compiler compliance level:选择和jdk一样的版本-->Apply and Close

   4.tomcat配置:Window-->Preferences-->Server-->Runtime Environments-->Add-->Apache-->Apache Tomcat v8.5(选择自己需要的版本,要和jdk匹配)-->Next-->JRE:选择已配置的JRE-->Finish-->Apply and Close

 

 

   5.创建tomcat实例:

    5.1打开Server窗口:2种方式

      5.1.1第一种:Window-->Show View-->Other-->Server-->Servers-->Open

      5.1.2第二种:在eclipse右上角选择Java EE模块,如果没有的话点击左边的小方块-->Open Perspective-->Java EE-->Open

 

     5.2创建tomcat实例:点击"No Servers are avilable,Click this link to create a new server..."-->Apache-->Tomcat v8.5 Server-->Finish

 

     5.3tomcat配置文件配置:双击Servers窗口下的tomcat,展示上面所示的配置信息,修改Server Locations,使用tomcat自己的项目路径,修改项目端口号为8081,修改后记得点击保存按钮

     6.maven仓库配置

    6.1maven配置:Windows-->Preferences-->maven-->installations-->add-->Directory-->选择本地maven-->Finish-->选中刚刚配置的maven-->Apply

 

 

    6.2maven .settings文件配置:Windows-->Preferences-->maven-->User Settings-->Browse-->选择maven文件夹下conf文件夹下的setting.xml文件-->Update Settings-->Apply-->Apply and Close

    6.3maven本地仓库配置:下面这个路径就是本地仓库的位置(为了每次新建maven项目时,不用都到maven中央仓库下载jar包,我们需要给maven配置一个本地仓库,用到的jar包都会下载到本地仓库,下次新建maven项目时,只需要从中央仓库下载本地仓库没有的jar包即可,节省很多构建maven项目的时间)

  7.取消校验配置:Windows-->Preferences-->Validation-->Disable All-->Apply-->Apply and Close

  8.ftl文件高亮配置:Windows-->Prefenrences-->General-->Edirors-->Files Associations-->选中*.ftl(若没有则添加一个)-->Associated editors-->Add:JSP Editors-->Default-->Apply and Close

需要接着设置编码,不然打开时会报错:Windows-->Prefenrences-->General-->Content Types-->JSP-->JSP Fragment-->Add:*.ftl-->Default encording:utf-8-->Apply and Close

 

四、启动项目

  1.部署项目:右击tomcat-->Add and Remove-->选中项目-->Add-->Finish

  2.启动项目:右击tomcat-->Start/Debug

 

原文地址:https://www.cnblogs.com/luna-hehe/p/14808708.html