解决Eclipse下Tomcat将项目部署到.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps下

今年3月份左右开始用2019年3月份的eclipse,一直有一个疑问,我的web项目部署后放在了哪里,我一直不知道怎么找,像myeclise的话就直接部署到了本地的tomcat的路径,但是eclipse给我部署到了那里,我用的apache-tomcat-8.0.53,在webapps里面根本没有我发布的web项目,虽然没有找到,但是项目也能正常运行,直到今天下午,我想获取我的项目中在src的下一级的properties的数据库的配置文件的时候,获取方法是:

String filepath="";
filepath=new StringBuffer(PropertiesFilePathUtil.class.getClassLoader().getResource("").getPath());
logger.info("filepath:"+filepath);

但是filepath的值始终都是:

[2019-08-26 19:40:15,795] [:] (PropertiesFilePathUtil.java:26) INFO  com.test.receive.utils.properties.PropertiesFilePathUtil - filepath:/D:/tools/eclipse/eclipse2019/eclipseworkspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/api/WEB-INF/classes/

我就很郁闷,为什么是这个路径,就在网上找了一些资料,
首先尝试了:
在这里插入图片描述

不起作用!接着查找前辈经验,根据这个博客:

https://blog.csdn.net/earthchinagl/article/details/79824074
找到了原因

最开始我先是::eclipse菜单栏Run -> Run Configurations -> Arguments -> VM arguments.

把里面的参数删掉了,但是当我再次运行的时候,就是还是原来的路径,

接着看了:D:\tools\eclipse\eclipse2019\eclipseworkspaces.metadata.plugins\org.eclipse.wst.server.core\tmp0\conf 目录的server.xml文件中有如下的设置:

<Context docBase="D:\tools\eclipse\eclipse2019\eclipseworkspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\api" path=/api"" reloadable="ture" source="org.eclipse.jst.jee.server:api"/>

说是把这个删掉重新发布就可以,但是我尝试了几遍后,每发布一次就又出现了,也没有解决。

最后尝试了调出

在这里插入图片描述

之所以是后面才尝试调用这个页面,是因为我前面不知道怎么调,不知道的同学需要先通过:
“eclipse”添加server窗口的办法:window -> show view -> server即可,在此页面:双击Tomcat v8.0 Server at localhost 即可调出此页面,调出后找到server Location :找到第二个选项:在deploy Path可以配置,使用Tomcat的安装路径。
就可以修改成本地的tomcat的路径了,再次运行找到的就是配置的本地的tomcat的路径了
我的tomcat的路径是:
在这里插入图片描述

再次看 Run Configurations -> Arguments -> VM arguments的参数值:
在这里插入图片描述
就变成想要的路径了。

发布了81 篇原创文章 · 获赞 10 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/fhf2424045058/article/details/100084813