Maven Plugin conflict -


what want run test in phase integration-test , generate report. mvn verify

but test executed report never runs. when comment first plugin other executed. idea how fix it?

i have below in 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> 

the problem due fact cucumber.api.cli.main calls system.exit , therefore terminates maven process before other plugin gets executed.

one way fix problem use exec goal of exec-maven-plugin, rather java goal, runs in separate process.

however, better (and easier) solution define junit test configure , run cucumber tests, example:

package integration;  import org.junit.runner.runwith;  import cucumber.api.junit.cucumber; import cucumber.api.cucumberoptions;  @runwith(cucumber.class) @cucumberoptions(plugin = "json:target/cucumber-report/cucumber.json") public class runtest { } 

you can use either maven-surefire-plugin or maven-failsafe-plugin plugin execute test. maven-cucumber-reporting plugin execute , create report.

you can see in action on github branch have pushed.


Comments