Java 在Maven中获取executionId

Java 在Maven中获取executionId,java,maven,cucumber-jvm,cucumber-junit,maven-failsafe-plugin,Java,Maven,Cucumber Jvm,Cucumber Junit,Maven Failsafe Plugin,我在pom.xml中的maven故障保护插件声明中有一个执行部分 <execution> <id>execId</id> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <in

我在
pom.xml
中的
maven故障保护插件
声明中有一个执行部分

<execution>
    <id>execId</id>
    <goals>
        <goal>integration-test</goal>
        <goal>verify</goal>
    </goals>
    <configuration>
        <includes>
            <include>**/*LauncherIT.java</include>
        </includes>
    </configuration>
</execution>
是否有一种方法可以在运行时访问
customCumber.java
中的执行id(并获取
“execId”
值)?

我知道可以在执行中定义一个系统变量,并将
“execId”
写入其中,但我想准确读取执行id。

如果我理解正确,您可以通过执行的参数
设置报告文件名。因此,只需将名称放在那里。

执行Id仅在maven插件中可用……但在测试中不可用。问题是:为什么在测试中需要
execId
?@khmarbaise,因为我使用的是jenkins,在构建之后,cucumber plugin提供了一些结果,这些结果由它们的功能文件命名。有些功能文件会多次运行(在执行中设置了不同的选项),因此最终我有一些同名的报告,我不知道是什么执行生成了特定的报告。因此,我需要id将其添加到默认报告名中。AFAIK如果您需要插件运行中的某些内容,您必须在
中输入一些参数。糟糕,我忘了说我使用cucumber
JSONFormatter
生成的报告。所以
不合适,因为它与故障保护报告一起工作。
@RunWith(CustomCucumber.class)
@io.cucumber.junit.CucumberOptions(
    plugin = {"json:target/cucumber.json"}
)
public class LauncherIT {
}