在使用maven构建项目的时候,maven使用了它自己的结构:
src
  |-main
  |  |- java
  |  |- resource
     |- webapp
           |- WEB-INF

但如果使用wtp dyna web project的时候,生成的目录结构则与此不同,在使用一些maven插件,如mvn war:inplace的时候,maven代仍为按照自身默认的结构来拷贝相应的jar包到lib目录下。为了使maven能够符合自己定义的目录结构,则需要使用一些插件来定制,下面给出一个符合WTP目录结构的pom.xml配置文件:

 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 2     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 3     <modelVersion>4.0.0</modelVersion>
 4     <groupId>cust_project</groupId>
 5     <artifactId>cust_project</artifactId>
 6     <packaging>war</packaging>
 7     <version>0.0.1-SNAPSHOT</version>
 8     <build>
 9         <plugins>
10             <plugin>
11                 <groupId>org.apache.maven.plugins</groupId>
12                 <artifactId>maven-compiler-plugin</artifactId>
13                 <configuration>
14                     <source>1.5</source>
15                     <target>1.5</target>
16                     <encoding>UTF-8</encoding>
17                 </configuration>
18             </plugin>
19             <plugin>
20                 <groupId>org.codehaus.mojo</groupId>
21                 <artifactId>build-helper-maven-plugin</artifactId>
22                 <version>1.1</version>
23                 <executions>
24                     <execution>
25                         <id>add-source</id>
26                         <phase>generate-sources</phase>
27                         <goals>
28                             <goal>add-source</goal>
29                         </goals>
30                         <configuration>
31                             <sources>
32                                 <source>src/java</source>
33                                 <source>src/resources</source>
34                             </sources>
35                         </configuration>
36                     </execution>
37                 </executions>
38             </plugin>
39             <plugin>
40                 <groupId>org.apache.maven.plugins</groupId>
41                 <artifactId>maven-war-plugin</artifactId>
42                 <configuration>
43                     <!-- 设置WebContent目录为Web目录 -->
44                     <warSourceDirectory>WebContent</warSourceDirectory>
45                 </configuration>
46             </plugin>
47         </plugins>
48         <outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
49     </build>
50     <dependencies>
51         
52 
53     </dependencies>
54 </project>