@@ -8,21 +8,61 @@ layout: default
8
8
9
9
## Introduction
10
10
11
- Hamcrest consists of a single jar, called ` java-hamcrest-<version>.jar ` (where ` <version> ` refers to the specific version of Hamcrest).
11
+ Hamcrest consists of different jars matching the different needs of
12
+ applications. This document describes these distributables and the
13
+ functionality contained in each of them.
14
+
15
+ ## The Java Hamcrest Jars
16
+
17
+ ### ` hamcrest-core.jar `
18
+
19
+ This is the core API to be used by third-party framework providers.
20
+ This includes a foundation set of matcher implementations for common
21
+ operations. This API is stable and will rarely change. You will
22
+ need this library as a minimum.
23
+
24
+ ### ` hamcrest-library.jar `
25
+
26
+ The library of Matcher implementations which are based on the core
27
+ functionality in hamcrest-core.jar.
28
+
29
+ ### ` hamcrest-integration.jar `
30
+
31
+ Provides integration between Hamcrest and other testing tools, such as jMock
32
+ and EasyMock. Uses hamcrest-core.jar and hamcrest-library.jar.
33
+
34
+ ### ` hamcrest-generator.jar `
35
+
36
+ A tool to allow many Matcher implementations to be combined into
37
+ a single class with static methods returning the different matchers
38
+ so users don't have to remember many classes/packages to import.
39
+ Generates code. This library is only used internally at compile time.
40
+ It is not necessary for the use of any of the other hamcrest libraries
41
+ at runtime.
42
+
43
+ ### ` hamcrest-all.jar `
44
+
45
+ One jar containing all classes of all the other jars.
12
46
13
- Currently, the latest version of Java Hamcrest is ` 2.0.0.0 ` , and so the binary distributable is called ` java-hamcrest-2.0.0.0.jar ` .
14
47
15
48
## Adding Hamcrest to your Project
16
49
50
+ The dependencies of the jars (` hamcrest-integration ` uses ` hamcrest-library `
51
+ which uses ` hamcrest-core ` ) is represented by the Maven dependency mechanism.
52
+ There is no ` hamcrest-all ` library in the Maven repo prior to version 1.3. Just
53
+ use hamcrest-integration which references all the other hamcrest libraries.
54
+
55
+
17
56
### Gradle
18
57
19
- Add ` "org.hamcrest:java-hamcrest:$hamcrestVersion" ` to the dependencies section of your ` build.gradle ` , for example:
58
+ Add ` "org.hamcrest:hamcrest-library:1.3" ` to the dependencies section of your
59
+ ` build.gradle ` , for example:
20
60
21
61
``` gradle
22
62
apply plugin: 'java'
23
63
24
64
dependencies {
25
- testImplementation 'org.hamcrest:java- hamcrest:2.0.0.0 '
65
+ testImplementation 'org.hamcrest:hamcrest-library:1.3 '
26
66
}
27
67
```
28
68
@@ -36,69 +76,23 @@ Add the following dependency declaration to your `pom.xml`:
36
76
``` xml
37
77
<dependency >
38
78
<groupId >org.hamcrest</groupId >
39
- <artifactId >java- hamcrest</artifactId >
40
- <version >2.0.0.0 </version >
79
+ <artifactId >hamcrest-library </artifactId >
80
+ <version >1.3 </version >
41
81
<scope >test</scope >
42
82
</dependency >
43
83
```
44
84
45
85
### Download
46
86
47
- You can download the jar directly from Maven Central. Hamcrest does
48
- not have any transitive dependencies, so you only need to download
49
- a single jar.
50
-
51
- You can find the jar by searching Maven Central for groupId ` org.hamcrest `
52
- and artifactId ` java-hamcrest ` using the following link:
87
+ You can download the jars directly from Maven Central. At a minimum, you will
88
+ need ` hamcrest-core-1.3.jar ` , though most people will also use
89
+ ` hamcrest-library-1.3.jar ` too. If you want to integrate Hamcrest Matchers with
90
+ other
53
91
54
- > [ https://search.maven.org/search?q=g:org.hamcrest%20AND%20a:java-hamcrest ] ( https://search.maven.org/search?q=g:org.hamcrest%20AND%20a:java-hamcrest )
55
-
56
- ## Previous Versions
57
-
58
- Prior to version 2.0.0.0, Java Hamcrest was distributed as different
59
- jars matching the different needs of applications. This document
60
- describes these distributables and the functionality contained in
61
- each of them.
62
-
63
- ### ` hamcrest-core-1.3.jar `
64
-
65
- This is the core API to be used by third-party framework providers.
66
- This includes a foundation set of matcher implementations for common
67
- operations. This API is stable and will rarely change. You will
68
- need this library as a minimum. From version 2.0.0.0, this is
69
- included in ` java-hamcrest.jar ` .
70
-
71
- ### ` hamcrest-library-1.3.jar `
72
-
73
- The library of Matcher implementations which are based on the core
74
- functionality in hamcrest-core.jar. From version 2.0.0.0, this is
75
- included in ` java-hamcrest.jar ` .
76
-
77
- ### ` hamcrest-generator-1.3.jar `
78
-
79
- A tool to allow many Matcher implementations to be combined into
80
- a single class with static methods returning the different matchers
81
- so users don't have to remember many classes/packages to import.
82
- Generates code. This library is only used internally at compile time.
83
- It is not necessary for the use of any of the other hamcrest libraries
84
- at runtime.
85
-
86
- ### ` hamcrest-integration-1.3.jar `
87
-
88
- Provides integration between Hamcrest and other testing tools,
89
- including JUnit (3 and 4), TestNG, jMock and EasyMock. Uses
90
- hamcrest-core.jar and hamcrest-library.jar.
91
-
92
- ### ` hamcrest-all.jar `
93
-
94
- One jar containing all classes of all the other jars.
92
+ You can find the jars by searching Maven Central for groupId ` org.hamcrest ` using the following link:
95
93
96
- ### Previous Maven Versions
94
+ > [ https://search.maven.org/search?q=g:org.hamcrest ] ( https://search.maven.org/search?q=g:org.hamcrest )
97
95
98
- The description above also applies to the hamcrest Maven
99
- artifacts. The dependencies of the jars (` hamcrest-integration `
100
- uses ` hamcrest-library ` which uses ` hamcrest-core ` ) is represented
101
- by the Maven dependency mechanism. There is no ` hamcrest-all `
102
- library in the Maven repo prior to version 2.0.0.0. Just use hamcrest-integration which
103
- references all the other hamcrest libraries. After version 2.0.0.0,
104
- all the specified jars have been replaced by ` java-hamcrest ` .
96
+ Maven central has some extra artifacts called ` java-hamcrest ` and ` hamcrest-java ` ,
97
+ with a version of ` 2.0.0.0 ` . Please do not use these, as they are an aborted effort
98
+ at repackaging the different jars.
0 commit comments