java.lang.NoSuchMethodError -- dependency conflict with jdi-dark-bdd breaks Cucumber Step Reporter
envgap__reportportal__agent-java-cucumber-89
Original GitHub issue ↗Opened 2023-03-22
01 / FAILURE SIGNATURE
As reported upstream
I get the following error:
Not a benchmark task.
- No curated issue-specific recipe or verified environment fix is available.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
build.gradle- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
reportportal/agent-java-cucumber #89 · read the original issue
**Describe the bug**
When I run this test:
```java
@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:
1. Use both `com.epam.jdi:jdi-dark-bdd` and `com.epam.reportportal:agent-java-cucumber6` with cucumber version >= `7.10.1`
2. 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:
```xml
<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>
```
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
Issue-specific recipe and runtime smoke command require review against the complete issue and repository.
Legacy reproduction is generic install-only; match the actual issue failure before admission.