Skip to content

Commit

Permalink
Make Mockito setup IntelliJ IDEA-compatible (#1500)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 authored Jan 9, 2025
1 parent 4aacc58 commit ff0e30c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ Other highly relevant commands:
against _all_ code in the current working directory. For more information
check the [PIT Maven plugin][pitest-maven].

When running the project's tests in IntelliJ IDEA, you might see the following
error:
Opening the project in IntelliJ IDEA may require running `mvn clean install`
first. Additionally, when running the project's tests using the IDE, you might
see the following error:

```
java: exporting a package from system module jdk.compiler is not allowed with --release
Expand Down
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
-Xmx${argLine.xmx}
<!-- Configure the Byte Buddy Java agent used by Mockito to create
mocks. -->
-javaagent:${org.mockito:mockito-core:jar}
-javaagent:${project.build.directory}/test-agents/mockito-core.jar
<!-- This argument cannot be set through Surefire's
'systemPropertyVariables' configuration setting. Setting the file
encoding is necessary because forked unit test invocations
Expand Down Expand Up @@ -1045,10 +1045,16 @@
</configuration>
<executions>
<execution>
<id>set-additional-properties</id>
<id>copy-test-agents</id>
<goals>
<goal>properties</goal>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.mockito</includeGroupIds>
<includeArtifactIds>mockito-core</includeArtifactIds>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/test-agents</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Expand Down

0 comments on commit ff0e30c

Please sign in to comment.