Eclipse:更改Maven pom.xml文件中的webapp文件夹 [英] Eclipse: Change webapp folder in Maven pom.xml file
问题描述
是否可以为webapp文件夹定义不同于pom.xml中的标准位置(/ src / main / webapp /)?我知道您可以使用
Is it possible to define a different location for the webapp folder than the standard one ("/src/main/webapp/") in pom.xml? I know that you can define your web folder with
<wb-resource deploy-path="/" source-path="/webapp"/>
在一个名为org.eclipse.wst.common.component的文件中。
问题是当我点击Maven - >更新项目时,这一行被覆盖了标准的
in a file called "org.eclipse.wst.common.component". The problem is when I click Maven -> Update Project, this line is overwritten with the standard
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
然后我在Eclipse中使用Tomcat7测试我的项目时遇到问题。
我非常感谢每一个提示。
And then I have problems testing my project with Tomcat7 within Eclipse. I'm very thankful for every hint.
推荐答案
如何配置自定义maven项目结构足以满足纯Maven构建,即从命令行。将项目导入Eclipse(通过m2e),您需要更多地了解m2e,以便可以在Eclipse中正确创建和维护项目结构。
Answers in How to configure custom maven project structure are sufficient for a purely Maven build, i.e. from commandline. When import the project into Eclipse (via m2e), you need tell m2e a little bit more so that it can create and maintain the project structure properly within Eclipse.
其实,从Eclipse的角度来看,它并不关心您的项目文件夹结构如何,只要将webapp文件夹声明为源文件夹或源文件夹,但是,通过修改.classpath并不太有意义它是一个自动生成的文件并经常更改。
Actually, from Eclipse's perspective, it doesn't really care about how your project folder structure looks like, as long as the webapp folder is declared as a source folder or inside a source folder, however, by modifying .classpath doesn't make much sense as it's a auto-generated file and changed quite often.
如果您能够使用以下配置进行自定义,则强烈建议遵守约定:
It is highly recommended to obey the convention if you are able to, if not, using the following configuration for your customization:
<build>
<resources>
<resource>
<directory>${basedir}/webapp</directory>
</resource>
... ...
</resources>
... ...
</build>
这篇关于Eclipse:更改Maven pom.xml文件中的webapp文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!