If you want to dive right into the first ArchUnit test, follow these steps

Add ArchUnit as dependency

ArchUnit can be obtained from Maven Central.

Maven

<dependency>
    <groupId>com.tngtech.archunit</groupId>
    <artifactId>archunit</artifactId>
    <version>0.8.0</version>
    <scope>test</scope>
</dependency>

Gradle

dependencies {
    testCompile 'com.tngtech.archunit:archunit:0.8.0'
}

Create a test

import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.lang.ArchRule;

import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;

public class MyArchitectureTest {
    @Test
    public void some_architecture_rule() {
        JavaClasses importedClasses = new ClassFileImporter().importPackages("com.myapp");
    
        ArchRule rule = classes()... // see next section
    
        rule.check(importedClasses);
    }
}

Let the API guide you

ArchUnit Fluent API

How to continue

For further information, for example how to use the extended JUnit 4 support supplying caching and more, check out the User Guide or examples for the current release at ArchUnit Examples.