testing - Maven - 在测试阶段提取/test/resources/my.zip in/target

标签 testing maven-2 resources zip

我有一些测试资源(特定于特定任务)压缩在 /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/

相关文章:

android - 是否有人使用硬件/ril 中包含的 mock-ril 测试了 android 电话?

java - 如何在多个 pom 文件中查找库的使用位置

C# 从原生 PE 中提取资源

c# - 使用资源中的变量进行字符串插值

java - 无法使用 junit 测试异常

java - 如何为使用硬件资源的类编写单元测试?

ios - 排毒运行时错误 :Detox instance has not been initialized

maven-2 - 创建 maven "target"目录的 zip 存档

maven - pom应该声明传递依赖吗?

java - 如何从资源文件夹中获取文件作为文件?