Skip to content

Commit

Permalink
Adjusted user guide, surefire-plugin 2.22.0 actually works without th…
Browse files Browse the repository at this point in the history
…e provider, as long as the engine dependency is added to the project test compile scope. This is somewhat broken, but seems to be the "Maven Way" at the moment.

Signed-off-by: Peter Gafert <[email protected]>
  • Loading branch information
codecholeric committed Mar 17, 2019
1 parent 7f5768a commit 8208535
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
27 changes: 10 additions & 17 deletions docs/userguide/002_Installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ A typical Maven configuration could look like this:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5-engine</artifactId>
<version>0.10.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand All @@ -71,16 +59,21 @@ A typical Maven configuration could look like this:
<version>0.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5-engine</artifactId>
<version>0.10.0</version>
<scope>test</scope>
</dependency>
</dependencies>
...
----

IMPORTANT: To run ArchUnit JUnit 5 tests within an IDE, it might unfortunately be necessary to add
`archunit-junit5-engine` as a project dependency with scope `test` as well.
Configuring `archunit-junit5-engine` as a dependency of the Surefire Plugin
compensates Maven's lack of a test runtime scope, but is not reliably understood by IDEs.
IMPORTANT: Unfortunately Maven lacks a test runtime scope, so the engine dependency must be added
to the test compile scope. Adding the engine dependency to the surefire-plugin
unfortunately does not work in the current version.

The configuration for Gradle is much simpler due to the existence of a test runtime scope:
The configuration for Gradle allows to clearly distinguish a test runtime scope:

[source,options="nowrap"]
.build.gradle
Expand Down
27 changes: 10 additions & 17 deletions docs/userguide/html/000_Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -641,18 +641,6 @@ <h3 id="_junit_5"><a class="anchor" href="#_junit_5"></a>2.2. JUnit 5</h3>
&lt;plugin&gt;
&lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
&lt;version&gt;2.22.0&lt;/version&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.junit.platform&lt;/groupId&gt;
&lt;artifactId&gt;junit-platform-surefire-provider&lt;/artifactId&gt;
&lt;version&gt;1.2.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.tngtech.archunit&lt;/groupId&gt;
&lt;artifactId&gt;archunit-junit5-engine&lt;/artifactId&gt;
&lt;version&gt;0.10.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
Expand All @@ -665,6 +653,12 @@ <h3 id="_junit_5"><a class="anchor" href="#_junit_5"></a>2.2. JUnit 5</h3>
&lt;version&gt;0.10.0&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.tngtech.archunit&lt;/groupId&gt;
&lt;artifactId&gt;archunit-junit5-engine&lt;/artifactId&gt;
&lt;version&gt;0.10.0&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
...</code></pre>
</div>
Expand All @@ -676,16 +670,15 @@ <h3 id="_junit_5"><a class="anchor" href="#_junit_5"></a>2.2. JUnit 5</h3>
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
To run ArchUnit JUnit 5 tests within an IDE, it might unfortunately be necessary to add
<code>archunit-junit5-engine</code> as a project dependency with scope <code>test</code> as well.
Configuring <code>archunit-junit5-engine</code> as a dependency of the Surefire Plugin
compensates Maven&#8217;s lack of a test runtime scope, but is not reliably understood by IDEs.
Unfortunately Maven lacks a test runtime scope, so the engine dependency must be added
to the test compile scope. Adding the engine dependency to the surefire-plugin
unfortunately does not work in the current version.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The configuration for Gradle is much simpler due to the existence of a test runtime scope:</p>
<p>The configuration for Gradle allows to clearly distinguish a test runtime scope:</p>
</div>
<div class="listingblock">
<div class="title">build.gradle</div>
Expand Down

0 comments on commit 8208535

Please sign in to comment.