11<!DOCTYPE html>
2- < html lang ="en ">
2+ < html lang ="">
33< head >
44< meta charset ="UTF-8 ">
55< meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
450450< div id ="header ">
451451< h1 > ArchUnit User Guide</ h1 >
452452< div class ="details ">
453- < span id ="revnumber "> version 1.3 .0</ span >
453+ < span id ="revnumber "> version 1.4 .0</ span >
454454</ div >
455455< div id ="toc " class ="toc2 ">
456456< div id ="toctitle "> Table of Contents</ div >
@@ -619,7 +619,7 @@ <h3 id="_junit_4"><a class="anchor" href="#_junit_4"></a>2.1. JUnit 4</h3>
619619< pre class ="highlightjs highlight nowrap "> < code class ="language-xml hljs " data-lang ="xml "> <dependency>
620620 <groupId>com.tngtech.archunit</groupId>
621621 <artifactId>archunit-junit4</artifactId>
622- <version>1.3 .0</version>
622+ <version>1.4 .0</version>
623623 <scope>test</scope>
624624</dependency></ code > </ pre >
625625</ div >
@@ -628,7 +628,7 @@ <h3 id="_junit_4"><a class="anchor" href="#_junit_4"></a>2.1. JUnit 4</h3>
628628< div class ="title "> build.gradle</ div >
629629< div class ="content ">
630630< pre class ="highlightjs highlight nowrap "> < code class ="language-none hljs "> dependencies {
631- testImplementation 'com.tngtech.archunit:archunit-junit4:1.3 .0'
631+ testImplementation 'com.tngtech.archunit:archunit-junit4:1.4 .0'
632632}</ code > </ pre >
633633</ div >
634634</ div >
@@ -649,7 +649,7 @@ <h3 id="_junit_5"><a class="anchor" href="#_junit_5"></a>2.2. JUnit 5</h3>
649649< pre class ="highlightjs highlight nowrap "> < code class ="language-xml hljs " data-lang ="xml "> <dependency>
650650 <groupId>com.tngtech.archunit</groupId>
651651 <artifactId>archunit-junit5</artifactId>
652- <version>1.3 .0</version>
652+ <version>1.4 .0</version>
653653 <scope>test</scope>
654654</dependency></ code > </ pre >
655655</ div >
@@ -658,7 +658,7 @@ <h3 id="_junit_5"><a class="anchor" href="#_junit_5"></a>2.2. JUnit 5</h3>
658658< div class ="title "> build.gradle</ div >
659659< div class ="content ">
660660< pre class ="highlightjs highlight nowrap "> < code class ="language-none hljs "> dependencies {
661- testImplementation 'com.tngtech.archunit:archunit-junit5:1.3 .0'
661+ testImplementation 'com.tngtech.archunit:archunit-junit5:1.4 .0'
662662}</ code > </ pre >
663663</ div >
664664</ div >
@@ -675,7 +675,7 @@ <h3 id="_other_test_frameworks"><a class="anchor" href="#_other_test_frameworks"
675675< pre class ="highlightjs highlight nowrap "> < code class ="language-xml hljs " data-lang ="xml "> <dependency>
676676 <groupId>com.tngtech.archunit</groupId>
677677 <artifactId>archunit</artifactId>
678- <version>1.3 .0</version>
678+ <version>1.4 .0</version>
679679 <scope>test</scope>
680680</dependency></ code > </ pre >
681681</ div >
@@ -684,7 +684,7 @@ <h3 id="_other_test_frameworks"><a class="anchor" href="#_other_test_frameworks"
684684< div class ="title "> build.gradle</ div >
685685< div class ="content ">
686686< pre class ="highlightjs highlight nowrap "> < code class ="language-none hljs "> dependencies {
687- testImplementation 'com.tngtech.archunit:archunit:1.3 .0'
687+ testImplementation 'com.tngtech.archunit:archunit:1.4 .0'
688688}</ code > </ pre >
689689</ div >
690690</ div >
@@ -2658,7 +2658,7 @@ <h4 id="_writing_tests"><a class="anchor" href="#_writing_tests"></a>9.1.1. Writ
26582658< h4 id ="_controlling_the_import "> < a class ="anchor " href ="#_controlling_the_import "> </ a > 9.1.2. Controlling the Import</ h4 >
26592659< div class ="paragraph ">
26602660< p > Which classes will be imported can be controlled in a declarative way through < code > @AnalyzeClasses</ code > .
2661- If no packages or locations are provided, the whole classpath will be imported.
2661+ If no packages or locations are provided, the package of the annotated test class will be imported.
26622662You can specify packages to import as strings:</ p >
26632663</ div >
26642664< div class ="listingblock ">
@@ -2705,6 +2705,35 @@ <h4 id="_controlling_the_import"><a class="anchor" href="#_controlling_the_impor
27052705< p > As explained in < a href ="#_the_core_api "> The Core API</ a > , you can write your own custom implementation of < code > ImportOption</ code >
27062706and then supply the type to < code > @AnalyzeClasses</ code > .</ p >
27072707</ div >
2708+ < div class ="paragraph ">
2709+ < p > To import the whole classpath, instead of just the package of the test class, use the option</ p >
2710+ </ div >
2711+ < div class ="listingblock ">
2712+ < div class ="content ">
2713+ < pre class ="highlightjs highlight nowrap "> < code class ="language-java hljs " data-lang ="java "> @AnalyzeClasses(wholeClasspath = true)</ code > </ pre >
2714+ </ div >
2715+ </ div >
2716+ < div class ="paragraph ">
2717+ < p > Note that < code > @AnalyzeClasses</ code > can also be used as a meta-annotation to avoid repeating the same configuration:</ p >
2718+ </ div >
2719+ < div class ="listingblock ">
2720+ < div class ="content ">
2721+ < pre class ="highlightjs highlight nowrap "> < code class ="language-java hljs " data-lang ="java "> @Retention(RetentionPolicy.RUNTIME)
2722+ @AnalyzeClasses(packagesOf = MyApplicationRoot.class, importOptions = DoNotIncludeTests.class)
2723+ public @interface AnalyzeMainClasses {}</ code > </ pre >
2724+ </ div >
2725+ </ div >
2726+ < div class ="paragraph ">
2727+ < p > This annotation can then be used on test classes without repeating the specific configuration of < code > @AnalyzeClasses</ code > :</ p >
2728+ </ div >
2729+ < div class ="listingblock ">
2730+ < div class ="content ">
2731+ < pre class ="highlightjs highlight nowrap "> < code class ="language-java hljs " data-lang ="java "> @AnalyzeMainClasses
2732+ public class ArchitectureTest {
2733+ // ...
2734+ }</ code > </ pre >
2735+ </ div >
2736+ </ div >
27082737</ div >
27092738< div class ="sect3 ">
27102739< h4 id ="_controlling_the_cache "> < a class ="anchor " href ="#_controlling_the_cache "> </ a > 9.1.3. Controlling the Cache</ h4 >
0 commit comments