KentBeck/junit — Issue #349: junit-dep and maven: wrong dependency scope
Author: alexeev
Created: 2011-10-21 09:23:35+00:00
State: open

The junit-dep module has the compile-scope dependency on hamcrest-core lib. I think it's wrong, since the build-in hamcrest-version appears in the classpath and can lead to conflicts. Maven configuration

<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>

results in Compile- and Runtime- availability of
- junit-dep-4.10
- hamcrest-core-1.1
- hamcrest-all-1.2

It would be better to set the dependency-scope of hamcrest-core to "provided" in the junit-dep module. The Maven configuration above would then result in:
- junit-dep-4.10
- hamcrest-all-1.2

At the moment we help ourself with exclusions as a workaround, in order to get a proper Compile- and Runtime classpath.