hamcrest-junit icon indicating copy to clipboard operation
hamcrest-junit copied to clipboard

Declare runtime dependency on JUnit and Hamcrest, not compile dependency

Open npryce opened this issue 10 years ago • 2 comments

This makes dependency management in client code easier.

npryce avatar Mar 18 '15 10:03 npryce

Yes, as it currently stands this project is pointless:

build.gradle

testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'

Nothing else.

gradle dependencies --configuration testCompile

testCompile - Classpath for compiling the test sources.
\--- org.hamcrest:hamcrest-junit:2.0.0.0
     +--- junit:junit:4.12
     |    \--- org.hamcrest:hamcrest-core:1.3
     \--- org.hamcrest:java-hamcrest:2.0.0.0

This makes things worse since java-hamcrest duplicates what's inside hamcrest-core.

TWiStErRob avatar Apr 30 '15 23:04 TWiStErRob

You are not meant to use hamcrest-junit by itself. The intended use is to allow JUnit to be used with the latest versions of Hamcrest. So, in your project, depend on the latest JUnit excluding transitive dependencies on Hamcrest, and depend on Hamcrest JUnit.

npryce avatar May 01 '15 07:05 npryce