Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven插件冲突_Maven_Maven Plugin_Cucumber Jvm_Test Reporting - Fatal编程技术网

Maven插件冲突

Maven插件冲突,maven,maven-plugin,cucumber-jvm,test-reporting,Maven,Maven Plugin,Cucumber Jvm,Test Reporting,我要做的就是在阶段集成测试中运行测试,然后生成报告。 通过mvn验证 但只有测试被执行,报告从不运行。当我评论第一个插件,然后执行另一个插件。知道怎么修吗 我的pom中有以下内容 <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-p

我要做的就是在阶段集成测试中运行测试,然后生成报告。 通过mvn验证

但只有测试被执行,报告从不运行。当我评论第一个插件,然后执行另一个插件。知道怎么修吗

我的pom中有以下内容

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <classpathScope>test</classpathScope>
                        <executableDependency>
                            <groupId>info.cukes</groupId>
                            <artifactId>cucumber-core</artifactId>
                        </executableDependency>
                        <mainClass>cucumber.api.cli.Main</mainClass>
                        <arguments>
                            <argument>target/test-classes/feature</argument>
                            <agrument>--glue</agrument>
                            <argument>integration</argument>
                            <argument>src\test\java</argument>
                            <argument>--plugin</argument>
                            <argument>pretty</argument>
                            <argument>--plugin</argument>
                            <argument>html:target/cucumber-report</argument>
                            <argument>--plugin</argument>
                            <argument>json:target/cucumber-report/cucumber.json</argument>
                            <argument>--tags</argument>
                            <argument>~@ignore</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>0.0.8</version>
            <executions>
                <execution>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>poc.selenium.it</projectName>
                        <outputDirectory>target/cucumber-report</outputDirectory>
                        <cucumberOutput>target/cucumber-report/cucumber.json</cucumberOutput>
                        <enableFlashCharts>true</enableFlashCharts>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

org.codehaus.mojo
execmaven插件
1.4.0
集成测试
JAVA
测试
信息杯
黄瓜核
cumber.api.cli.Main
目标/测试类/功能
--胶水
整合
src\test\java
--插件
漂亮的
--插件
html:target/cumber报告
--插件
json:target/cucumber report/cucumber.json
--标签
~@忽略
网络智囊团
马文黄瓜报道
0.0.8
验证
生成
poc.selenium.it
目标/目标报告
target/cumber报告/cumber.json
真的

问题的原因是
cucumber.api.cli.Main
,因此在执行其他插件之前终止Maven进程

解决此问题的一种方法是使用
execmaven插件的
exec
目标,而不是
java
目标,因为它在单独的进程中运行

但是,更好(更简单)的解决方案是定义一个JUnit测试,用于配置和运行cucumber测试,例如:

包集成;
导入org.junit.runner.RunWith;
进口cucumber.api.junit.cucumber;
进口cucumber.api.CucumberOptions;
@RunWith(cumber.class)
@CucumberOptions(plugin=“json:target/cucumber report/cucumber.json”)
公共类运行测试{
}
然后,您可以使用
maven-surefire插件
maven-failsafe插件
来执行该测试。然后,
maven cucumber reporting
插件将成功执行并创建报告


你可以在一张照片上看到这一点。

谢谢你的明确回答,这对我很有用。我太沮丧了!!