Eclipse: change webapp folder in Maven pom.xml file

Is it possible to determine 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 using

<wb-resource deploy-path="/" source-path="/webapp"/> 

in a file called org.eclipse.wst.common.component. The problem is that when I click Maven -> Update Project, this line is overwritten with the standard

 <wb-resource deploy-path="/" source-path="/src/main/webapp"/> 

And then I have problems testing my project with Tomcat7 in Eclipse. I am very grateful for every hint.

+7
source share
1 answer

Answers How to configure a custom maven project structure is enough for a pure Maven build, i.e. from the command line. When you import a project into Eclipse (via m2e), you need to specify m2e a bit so that it can correctly create and maintain the project structure in Eclipse.

In fact, from the point of view of Eclipse, it really doesn’t matter what the folder structure of the project looks like if the webapp folder is declared as the source folder or inside the source folder, however, changing .classpath, t makes a lot of sense, since it is automatically generated file and changed frequently.

It is highly recommended that you comply with the agreement if you can, if not, use the following configuration for your setup:

 <build> <resources> <resource> <directory>${basedir}/webapp</directory> </resource> ... ... </resources> ... ... </build> 
+12
source

All Articles