Name | Type | Since | Description | 默认值 |
---|---|---|---|---|
cacheFile | File | 2.1-alpha-1 | 包含webapp结构的文件缓存 | ${project.build.directory}/war/work/webapp-cache.xml. |
outputDirectory | String | - | 用于输出WAR的目录 | ${project.build.directory}. |
warSourceDirectory | File | - | WAR中包含额外文件的单个目录.这里是你放置JSP文件的地方 | ${basedir}/src/main/webapp. |
webappDirectory | File | - | 构建webapp的目录 | ${project.build.directory}/${project.build.finalName}. |
workDirectory | File | - | 解压WAR可选相关内容的目录 | ${project.build.directory}/war/work. |
war包插件:
既然是web项目,就需要打war包,那就需要这个插件:
1 <plugin> 2 <groupId>org.apache.maven.plugins</groupId> 3 <artifactId>maven-war-plugin</artifactId> 4 <version>2.1.1</version> 5 <configuration> 6 <encoding>${project.build.sourceEncoding}</encoding> 7 <warName>platform</warName> 8 <webappDirectory>${project.build.directory}/platform</webappDirectory> 9 <warSourceDirectory>WebContent</warSourceDirectory> 10 </configuration> 11 </plugin>
<encoding>${project.build.sourceEncoding}</encoding>强制字符集编码
<warName>platform</warName>war包名字——platform.war
<webappDirectory>${project.build.directory}/platform</webappDirectory>产生war前,用于存放构建war包的目录——target/platform。
<warSourceDirectory>WebContent</warSourceDirectory>:我把web工程搞成了eclipse下的WTP类型。我不喜欢maven产生的webapp目录,更喜欢WebContent!