我有一些测试资源(特定于特定任务)压缩在 /test/resources/my.zip
中。
我想在 Maven 测试阶段将 zip 内容提取到 /target
。
你知道我应该在 pom.xml
中指定什么来实现这个吗?
最佳答案
一种解决方案是使用 maven-antrun-plugin运行 unzip Ant task . POM 的构建部分中的以下配置应该是您所需要的(但我还没有测试过):
<build>
<plugins>
<!-- ... -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<unzip src="test/resources/my.zip" dest="target/" overwrite="true"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<!-- ... -->
</plugins>
</build>
关于testing - Maven - 在测试阶段提取/test/resources/my.zip in/target,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1755464/