maven项目生成war包

eclipse:
配置 你的pom.xml文件,在你的overview视窗里 配置 packaging为 war 然后添加

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warName>ROOT</warName>
<archiveClasses>true</archiveClasses>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src\main\resources</directory>
<targetPath>WEB-INF\classes</targetPath>
<!-- the list has a default value of ** -->
<includes>
<include>**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>

然后点击 pom.xml右键,run  as 选择 install 或是 package
如果项目没问题,配置没问题
就会在项目的
========================================更新=====================================================
idea命令行操作:
mvn clean
mvn package
忽略test打包: mvn package -Dmaven.test.skip=true
posted @ 2016-09-29 16:54  AmbitiousMice  阅读(9837)  评论(0编辑  收藏  举报