我使用maven-dependency-plugin将当前工件复制到自定义目录中:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-to-dsf-server</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${tomcat.dsf.dir}/lib/pacifisc</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
但是当工件版本发生变化时,我将同一个jar的两个版本放入目标目录中。如何删除旧版本?
此致 阿诺
答案 0 :(得分:9)
我终于使用了maven-clean-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<id>clean-dsf-server</id>
<phase>package</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<filesets>
<directory>${tomcat.dsf.dir}/lib/pacifisc</directory>
<includes>
<include>${project.artifactId}*.jar</include>
</includes>
</filesets>
</filesets>
</configuration>
</execution>
</executions>
</plugin>