我有一个mvn脚本,它编译了一些代码,并在编译后为tomcat部署了一些war。在测试之前和之后我需要进行一些复制和删除。我怎么能这样做我当前的pom.xml如下所示
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.web</groupId>
<artifactId>TwoDThreeDCapture</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>TwoDThreeDCapture Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<tomcat.url>http://127.0.0.1:8080/manager/html</tomcat.url>
<tomcat.username>http://127.0.0.1:8080/manager/html</tomcat.username>
<install.path>/TwoDThreeDCapture</install.path>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId> mockito-core</artifactId>
<version>1.9.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
<scope>compile</scope>
<!-- <systemPath>/home/tharanga/Software/json_simple-1.1.jar</systemPath> -->
</dependency>
<dependency>
<groupId>ar.com.hjg</groupId>
<artifactId>pngj</artifactId>
<version>2.0.1</version>
<scope>compile</scope>
<!-- <systemPath>/home/tharanga/Software/pngj-2.0.0.jar</systemPath> -->
</dependency>
</dependencies>
<build>
<finalName>TwoDThreeDCapture</finalName>
<defaultGoal>install</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<target unless="maven.test.skip">
<copy todir=".">
<fileset dir="src/main/resources">
<include name="*.png"/>
</fileset>
</copy>
<copy todir="src/main/webapp">
<fileset dir="WebContent">
<include name="*.html"/>
<include name="*.js"/>
<include name="*.css"/>
</fileset>
</copy>
<copy todir="src/main/webapp/WEB-INF/lib/">
<fileset dir="WebContent/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
<configuration>
<url>${tomcat.url}</url>
<server>TomcatServer</server>
<path>${install.path}</path>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
我想知道我做的是否正确,但这个pom失败了,因为所需的png文件没有被复制到正确的位置。我希望在运行测试之前进行应对。希望有人可以帮助我。