关于Eclipse非maven项目迁移到Idea解决方案

关于Eclipse非maven项目迁移到Idea解决方案

idea导入eclipse非maven web项目流程

1.idea默认打开上次打开的项目,设置其为打开初始界面

File ->Settings -> Appearance & Behavior ->System Settings -> Startup/Shutdown 取消勾选 Reopen last project on startup项

在这里插入图片描述

2.导入eclipse项目

在主界面open…选中需要导入的项目即可

在这里插入图片描述

3.项目配置
1.打开 File Project Structure

在这里插入图片描述

2.Project Setting下设置项目的jdk 编译后class文件目录 (Project)

在这里插入图片描述

3.Modules编写

在这里插入图片描述

3.Libraries jar包导入 (需要导入你项目需要的所有jar,若在不同文件夹下,则进行多次导入)

在这里插入图片描述

5.Facetts配置

在这里插入图片描述

6.Artifacts配置

在这里插入图片描述

7.点击Apply即会进行项目整合
8.变编译方修改
File --> Settings --> Build,Execution,Deployment -->Compiler --> Java Compiler --> Use Compiler – >选择 javac–>选择对应的jdk版本–>添加项目模块 ( 注 : 如遇到编译时显示内存不足,则按照eclipse方式进行编写, 有两台电脑一台按照javac编译没有问题,一台就报内存溢出,怀疑和java内存设置有关)

在这里插入图片描述

4.tomcat配置

######1.选择Edit Configurations
在这里插入图片描述

2.添加项目的tomcat 点击添加按钮 --> Tomcat Server --> Local

此处需注意,若屏幕高度过窄的话,可能点击添加按钮后,看不到tomcat,只需向下拉即可看到
在这里插入图片描述

3.tomcat配置 只需要配置Server 和Deployment两处即可

server配置
在这里插入图片描述

Deployment配置
在这里插入图片描述

4.配置结束后的样子

在这里插入图片描述

配置结束,到这里即可在idea中运行eclipse项目,下面为运行过程中遇到的一些问题

针对idea输出中文乱码解决

1.编译java出现中文乱码

Settings -> Build,Execution,Deployment -> Compiler -> javaCompiler 下的Additional command line parameters 后填入-encoding utf-8 然后apply

2.项目文件中文乱码

Settings -> Editor -> File Encodings内将Global Encoding ,Project Encoding ,Default encoding for properties files 都设置为UTF-8 (即所有能设置为utf-8的地方都设置为utf-8)

3.idea内解决tomcat输出控制台乱码

在tomcat控制界面中 Server 下的VM options内输入-Dfile.encoding=UTF-8,重启基本能解决编码问题
在这里插入图片描述

4.在D:\IntelliJ IDEA 2018.1.4\bin\idea64.exe.vmoptions文件里面末尾位置添加-Dfile.encoding=UTF-8重启idea,即可解决控制台输出中文乱码问题

注 : 我是全部设置完重启idea解决tomcat启动控制台输出中文乱码问题

tomcat设置

1.中文乱码问题 : (idea工具下 : 前端页面传递数据到后端出现中文乱码)

打开D:\Tapache-tomcat-7.0.93\conf\sever.xml进行如下配置:

 <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" 
               useBodyEncodingForURI="true"
               IEncoding="utf-8"/>
     即在<Connector>标签内增加编码配置,redirectPort="8443" 		useBodyEncodingForURI="true"  IEncoding="utf-8"
2.idea中tomcat启动报错 : LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[链接地址].StandardContext[/项目名]]

修改tomcat\conf\catalina.properties 中

org.apache.catalina.startup.ContextConfig.jarsToSkip=
为
org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar
3.idea中启动tomcat报错 : 严重: End event threw exception java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter

在tomcat\conf\context.xml中增加如下标签

<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
    <!--增加代码-->
    <Loader delegate="true" />

</Context>
4.在tomcat中增加用户名,密码 主要用于tomcat主页面manager app查看tomcat中项目使用 若不增加用户名密码,则不能登录manager app

在tomcat/conf/tomcat-users.xml中增加如下标签

<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  application.
-->
<!--
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
    <!--增加代码-->
    <user username="用户名" password="密码" roles="manager-gui"/>
</tomcat-users>

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值