agent-java-cucumber
agent-java-cucumber copied to clipboard
java.lang.NoSuchMethodError -- dependency conflict with jdi-dark-bdd breaks Cucumber Step Reporter
Describe the bug When I run this test:
@RunWith(Cucumber.class)
@CucumberOptions(plugin = { "pretty", "com.epam.reportportal.cucumber.StepReporter" })
public class RunTests {
}
I get the following error:
java.lang.NoSuchMethodError: 'java.util.Optional io.cucumber.core.gherkin.FeatureParser.parse(java.net.URI, java.io.InputStream, java.util.function.Supplier)'
The reason seems to be the transitive dependency of io.cucumber:cucumber-gherkin that comes into conflict with jdi-dark-bdd and overrides it. Here's the relevant output from mvn dependency:tree:
[INFO] +- com.epam.reportportal:agent-java-cucumber6:jar:5.1.3:compile
...
[INFO] | +- io.cucumber:cucumber-gherkin:jar:7.3.4:compile
[INFO] | | \- io.cucumber:cucumber-plugin:jar:7.3.4:compile
...
and:
[INFO] +- com.epam.jdi:jdi-dark-bdd:jar:1.1.13:compile
[INFO] | +- com.epam.jdi:jdi-dark:jar:1.1.13:compile
...
[INFO] | +- io.cucumber:cucumber-java:jar:7.10.1:compile
[INFO] | +- io.cucumber:gherkin:jar:26.0.2:compile
[INFO] | | \- io.cucumber:messages:jar:19.1.4:compile (version selected from constraint [19.1.4,22.0.0))
...
Steps to Reproduce Steps to reproduce the behavior:
- Use both
com.epam.jdi:jdi-dark-bddandcom.epam.reportportal:agent-java-cucumber6with cucumber version >=7.10.1 - Try to launch a test
Expected behavior The test should launch.
Actual behavior
The test does not launch and the execution ends with NoSuchMethodError.
Dependency versions Included above.
Additional context I was able to solve the issue by excluding the transitive dependency like this:
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-cucumber6</artifactId>
<version>5.1.3</version>
<exclusions>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-gherkin</artifactId>
</exclusion>
</exclusions>
</dependency>
@n524922 Dependency conflicts are usually user's area of responsibility.