Bundled Dependencies currently getting hamcrest mismatch error
Steady5063 opened this issue · comments
Currently when using our bundled java dependencies in a project, when running test command we get the following error:
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
The test cases run and the results are created via log and JSON, however, we do not get that the test case failed because isAxeClean() was asserted, its that there is a hamcrest mismatch.
Here is how I am currently calling the local jars (a setup most clients we have who use them use):
<dependency>
<groupId>com.deque.html.axe-devtools</groupId>
<artifactId>selenium</artifactId>
<version>4.1.2</version>
<classifier>jar-with-dependencies</classifier>
<scope>system</scope>
<systemPath>${basedir}/src/test/resources/selenium-4.1.2-jar-with-dependencies.jar</systemPath>
</dependency>
I have currently tried matching the versions of hamcrest, excluding hamcrest matchers that are bundled in J-unit, AND have tried maven installing, all with no luck at all to get the error to stop.
If more information is needed please let me know!
So it turns out that when creating a fat jar, the maven assembly plugin includes test dependencies. It is likely that the hamcrest bundled in the selenium jar is causing the issue. A fix will be included in 4.1.3.
Until then, if you can make do with what is bundled, there is junit:junit:4.13.1
and org.hamcrest:hamcrest-core:jar:1.3
@SantoshDeque and @padmavemulapati plz pick this up
Verified with both old(selenium-4.1.2-jar-with-dependencies.jar) and new(selenium-4.1.2-SNAPSHOT-jar-with-dependencies.jar) dated(2021-01-19) bundled jars and below are the observations
1)With old jars and with/without including 'JUnit' dependency in pom.xml file it is giving the error "java.lang.NoSuchMethodError: 'void org.hamcrest.Matcher.describeMismatch(java.lang.Object, org.hamcrest.Description)'"
2)With new jar and without including 'JUnit' dependency in pom.xml file it is giving same above error
3)With new jar and with 'JUnit' dependency included in pom.xml file, it is not giving the error
No docs required