maven 执行ant 任务

<build>
<plugins>
<plugin>
		        <artifactId>maven-antrun-plugin</artifactId>
		        <version>1.7</version>
		        <executions>
		          <execution>
		            <phase>compile</phase>
		            <configuration>
		              <target>
		              	<echo message="开始打包1"/>
		              	<zip destfile="xxxxx.zip"
							       basedir="target/"
							  />
						<echo message="打包完成"/>
		              </target>
		            </configuration>
				    <goals>
		              <goal>run</goal>
		            </goals>
		          </execution>
		        </executions>
		        
		         <configuration>
		              <target>
		              	<echo message="开始打包2"/>
		              	<zip destfile="xxxxx.zip"
							       basedir="target/"
							  />
						<echo message="打包完成"/>
		              </target>
		            </configuration>
		      </plugin>
		</plugins>
	</build>




“开始打包1”任务定义在了executions里,会在<phase>定义的生命周期里运行,此处是在compile阶段

"开始打包2" 在运行mvn antrun:run命令时,就会直接执行

猜你喜欢

转载自powertech.iteye.com/blog/2170048