Maven + Surefire:覆盖温度和输出目录

时间:2018-07-13 16:25:11

标签: maven maven-surefire-plugin

我正在尝试覆盖surefire插件的临时目录和输出目录。我有以下插件定义:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.0</version>
    <configuration>
        <tempDir>c:/tmp/a-tests-temp</tempDir>
        <outputDirectory>c:/tmp/a-tests-out</outputDirectory>
    </configuration>
</plugin>

它不起作用。它继续使用/target/surefiretarget/surefire-reports

想法是在同一项目目录上拆分不同的并发Maven测试运行,以便在开发人员工作站上进行快速测试。

1 个答案:

答案 0 :(得分:0)

对不起,我晚答复,我只设法使用相对路径位置来更改临时文件夹的路径

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${surefire.plugin.version}</version>
    <configuration>
        <testClassesDirectory>${project.buildDirectory}/test-classes</testClassesDirectory>
        <reportsDirectory>${project.buildDirectory}/surefire-reports</reportsDirectory>
        <classesDirectory>${project.buildDirectory}/test-classes</classesDirectory>
        <tempDir>../${project.buildDirectory}/surefire</tempDir>
        <useFile>false</useFile>
        <includes>
            <include>**/*Spec.*</include>
        </includes>
        <systemPropertyVariables>
            <geb.env>${geb.env}</geb.env>
            <geb.build.reportsDir>${project.buildDirectory}/${geb.build.reportsDir}</geb.build.reportsDir>
            <com.athaydes.spockframework.report.outputDir>${project.buildDirectory}/spock-reports</com.athaydes.spockframework.report.outputDir>
            <com.athaydes.spockframework.report.aggregatedJsonReportDir>${project.buildDirectory}/spock-reports</com.athaydes.spockframework.report.aggregatedJsonReportDir>
        </systemPropertyVariables>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>