Closed GoogleCodeExporter closed 9 years ago
Place your hamcrest dependency above JUnit
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-integration</artifactId>
<version>1.3.RC2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
This is because JUnit 4.10 includes an older hamcrest package.
Original comment by oliver....@gmail.com
on 28 Nov 2011 at 7:44
I just saw in the Maven Dependency Hierarchy view in Eclipse that hamcrest-core
1.3.RC2 was omitted for conflict with 1.1. Indeed, junit-dep pulls
hamcrest-core 1.1.
Thus,
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId><!-- junit without hamcrest -->
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
does the trick.
However, I don't get the point of providing an artifact like "junit-dep" that
again depends on the left out classes - see
https://github.com/KentBeck/junit/issues/349.
Original comment by mburger313@gmail.com
on 28 Nov 2011 at 9:06
[deleted comment]
Better is to use Dependency Management to solve this.
You can put this into your parent pom or (if you are not using one) in your
project pom:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3.RC2</version>
</dependency>
</dependencies>
</dependencyManagement>
This is not really a hamcrest issue. It is the regular maven dependency
resolution mechanism...
Closing this issue because for hamcrest here is nothing to do.
Original comment by marc.von...@gmail.com
on 12 Apr 2012 at 7:31
Original issue reported on code.google.com by
mburger313@gmail.com
on 24 Nov 2011 at 2:18