8000 fix: gradle mockitoAgent configuration should not be transitive (#3454) · mockito/mockito@39a0c75 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39a0c75

Browse files
authored
fix: gradle mockitoAgent configuration should not be transitive (#3454)
See #3037 Follow up to #3437
1 parent e928059 commit 39a0c75

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/main/java/org/mockito/Mockito.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,15 @@
176176
* to function without an explicit setup to enable instrumentation, and the JVM will always display a warning.
177177
*
178178
* <p>
179-
* To explicitly attach Mockito during test execution, the library's jar file needs to be specified as `-javaagent`
179+
* To explicitly attach Mockito during test execution, the library's jar file needs to be specified as <code>-javaagent</code>
180180
* as an argument to the executing JVM. To enable this in Gradle, the following example adds Mockito to all test
181181
* tasks:
182182
*
183183
* <pre class="code"><code class="kotlin">
184184
* val mockitoAgent = configurations.create("mockitoAgent")
185185
* dependencies {
186-
* mockitoAgent(libs.mockito)
186+
* testImplementation(libs.mockito)
187+
* mockitoAgent(libs.mockito) { isTransitive = false }
187188
* }
188189
* tasks {
189190
* test {
@@ -192,6 +193,16 @@
192193
* }
193194
* </code></pre>
194195
*
196+
* Supposing <code>Mockito</code> is declared in the version catalog as the following
197+
*
198+
* <pre class="code"><code class="toml">
199+
* [versions]
200+
* mockito = "5.14.0"
201+
*
202+
* [libraries]
203+
* mockito = { module = "org.mockito:mockito-core", version.ref = "mockito" }
204+
* </code></pre>
205+
*
195206
* To add Mockito as an agent to Maven's surefire plugin, the following configuration is needed:
196207
*
197208
* <pre class="code"><code class="xml">

0 commit comments

Comments
 (0)
0