场景:我看到maven约定的webapp藏的目录太深了,它在src/main/webapp,我想把它提到根目录下,并且命名为WebContent,应该怎么配置呢?
在pom.xml里面加上如下配置:
<build>
<plugins>
<!-- 修改webapp目录为WebContent -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- 设置WebContent目录为Web目录 -->
<webappDirectory>${basedir}/WebContent</webappDirectory>
<warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
然后觉得没问题了,但是在MyEclipse用Servers在tomcat部署的时候,竟然WebContent下的内容没有发布到项目中,找了好久,
在项目属性设置了:
1. Myeclipse->Web->Web root-folder
2. java构建路径也要设置
3. Flex构建路径的输出文件夹也要设置
4. 最后还要修改项目目录下的.settings文件夹下的org.eclipse.wst.common.component这个文件里面的名字,最后才发布成功。