Maven webapp与Eclipse和WTP插件在Tomcat中以陌生的方式部署文件 [英] Maven webapp with Eclipse and WTP plugin deploy files in stranges ways in Tomcat

查看:139
本文介绍了Maven webapp与Eclipse和WTP插件在Tomcat中以陌生的方式部署文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse J2EE 3.5与Maven和tomcat。要使用WTP部署我的maven webapp,我添加了动态Web模块方面,并更改了项目的org.eclipse.wst.common.component文件,因为webapp不在WebContent目录中,这里是文件的内容:

 <?xml version =1.0encoding =UTF-8?> 
< project-modules id =moduleCoreIdproject-version =1.5.0>
< wb-module deploy-name =toto>
< wb-resource deploy-path =/source-path =/ src / main / webapp/>
< wb-resource deploy-path =/ WEB-INF / classessource-path =/ src / main / java/>
< wb-resource deploy-path =/ WEB-INF / classessource-path =/ src / main / resources/>
< property name =context-rootvalue =toto/>
< property name =java-output-pathvalue =/ toto / target / classes/>
< / wb-module>
< / project-modules>

但是它不会在workspace.metadata.plugins\org.eclipse中正确部署内容。 webstore和org.eclipse.wst.server.core\tmp1\wtpwebapps\toto\WEB-INF\classes\与另一个WEB-INF和META-INF结构,但与文件。



我不明白这一点,谢谢。

解决方案

你不应该乱手动创建面和Eclipse配置文件,这些文件应该从Maven POM派生。要这样做,请使用 maven-eclipse-plugin 来生成Eclipse使用您的Maven项目的特定文件,或使用 m2eclipse 插件,使Eclipse能够处理Maven项目。



这两种方法都提供Maven / Eclipse集成和支持WTP(即允许将项目识别为动态项目,而不是在服务器上运行。 。),但也不同。前者很轻,只生成Eclipse文件,后来提供了完整的集成,向导等,但更重。我一直是一个幸福的用户,使用一个或者它真的取决于你要找什么。



以防万一,如果你决定安装 m2eclipse,请确保安装可选的Maven Maven Integration for WTP 组件从m2eclipse Extras更新站点..


I use Eclipse J2EE 3.5 with Maven and tomcat. To deploy my maven webapp with WTP I added a Dynamic Web Module facet and changed the "org.eclipse.wst.common.component" file of the project because the webapp is not in a WebContent directory, here is the content of the file:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="toto">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="toto"/>
<property name="java-output-path" value="/toto/target/classes"/>
</wb-module>
</project-modules>

But it never deploy the content correctly, in "workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\toto\" the directory structure is correct with WEB-INF and META-INF but empty, the jsp, html, css files are in "workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\toto\WEB-INF\classes\" with another WEB-INF and META-INF structure but with the files.

I don't understand this at all, thanks.

解决方案

You shouldn't mess with facets and Eclipse configuration files manually, these files should be derived from the Maven POMs. To do so, either use the maven-eclipse-plugin to generate Eclipse specific files from your Maven project or use the m2eclipse plugin to make Eclipse able to deal with Maven projects.

Both approaches provide Maven/Eclipse integration and support the WTP (i.e. allow to get your project recognized as a dynamic project than you can Run on a Server...), but are also different. The former is very light and only generates Eclipse files, the later provides full integration, wizards, etc but is heavier. I've been an happy user of both, using one or the othe really depends of what you're looking for.

Just in case, if you decide to install m2eclipse, make sure to install the optional Maven Integration for WTP component from the the m2eclipse Extras update site..

这篇关于Maven webapp与Eclipse和WTP插件在Tomcat中以陌生的方式部署文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆