一、配置
默认前两个是没有勾选的,应该勾选上:


在默认情况下,当项目部署到tomcat中,该插件会把项目文件拷贝到上一个配置项Server Locations中的显示Server path的wtpwebapps目录下,即当前wrokspace所在目录下的。 data子目录中,如我的wrokspace是D:\workspace,那么该目录是:D:\workspace\. data\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps。
但如果选中上面的这个选项,则不会把项目文件发布到该目录下运行,而是:
web资源目录是:web项目的WebContent,即maven web项目的src/main/webapp目录
class文件目录是:是当前配置的class文件的输出目录,即maven项目的target/classes目录
(2)Timeouts
默认情况下start为45秒,stop为15秒,这里可能需要修改一下start为一个合适大的值,它的意思是当启动时间超过这里指定的时间还没有启动完成时,就报错。当我们的项目启动很耗时的情况下,这显然不是我们想要的,所以需要修改一下这个值。
勾选上Server Options->Serve Modules without publishing,不勾的话,修改类文件里就会不停的重启Web服务器;如果Web项目启动时间比较长的话,还需要修改超时时间,这个在Timeouts里面设置
在Cotext节点中有一个reloadable='true'属性,将它改为false,可以在修改java文件后不用重启服务器即可生效,但是不包括新建java文件、添加方法和变量的操作
二、浏览文件
Context节点单独生成的文件:

原来Tomcat安装目录下conf/server. 中的Context节点(勾选第二个选项之后,server. 中就不存在这个节点了):
<Host app ="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context doc ="D:\workspace\workspace(eclipse)\Shop\WebContent" path="/Shop" reloadable="true" source="org.eclipse.jst.jee.server:Shop">
<Resources>
<PreResources ="D:\workspace\workspace(eclipse)\Shop\build\classes" classLoaderOnly="false" className="org.apache.catalina.webresources.DirResourceSet" internalPath="/" webAppMount="/WEB-INF/classes"/>
</Resources>
</Context>
</Host>
三、原因
1.勾选第一个是为了防止出现警告:
警告: A doc D:/Tomcat/webapps/Shop inside the host app has been specified, and will be ignored
勾选后表示让tomcat直接使用eclipse中的WebContent下的东西
省去publish到<workspace>. data.pluginsorg.eclipse.wst.server.coretmp0webapps
并将tmp0webapps下相关的resources删除,
同时会修改<workspace>. data.pluginsorg.eclipse.wst.server.coreservers. 中的serveModulesWithoutPublish=true以及tmp0/conf/server. 中的<Context>配置
2.勾选第二个是为了防止出现警告:
警 告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:strut2demo' did not find a matching property.
[SetPropertiesRule]警告的原因是Tomcat6.0以上的server. 的context节点中不再支持source属性了。具体说明如下:
For Tomcat 6, unlike Tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server. file. This is because it makes modifying the Context configuration more invasive since the main conf/server. file cannot be reloaded without restarting Tomcat.

优化
找到菜单,Window->Preferences
检查英文的拼写没什么用处,这里把拼写检查取消,位置:General->Editors->Text Editors->Spelling,把Enable spell checking 取消勾选
还有一处的检查也可以取消 位置:Validation,勾选Suspend all validators
显示行号 位置:General->Editors->Text Editors,勾选Show line numbers
把jsp页面的默认编码方式改为utf-8 位置:Web->JSP Files,Encoding改为ISO 10646/Unicode(UTF-8)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
继续阅读与本文标签相同的文章
-
微功能号:不需要借助任何辅助工具!微功能号给你美妙的多群直播体验
2026-05-18栏目: 教程
-
加快检测速度以减缓埃博拉疫情:智能手机应用程序改变了对刚果
2026-05-18栏目: 教程
-
微信小程序前景大好,寻找第三方公司进行开发靠谱吗?
2026-05-18栏目: 教程
-
谷歌翻脸无用,华为淡然应对,成功挽回海外市场
2026-05-18栏目: 教程
-
申请入驻小程序付费吗?自主开发和第三方公司开发应该如何选择?
2026-05-18栏目: 教程
