ArchUnitJava

Architecture testing for Java. Read class directories and JARs without loading target classes, build an immutable dependency model, and evaluate architecture policies with explicit completeness. ArchUnitJava 0.1.0 is available from Maven Central for JUnit, CLI, and lower-level Java API workflows.

JDK 25; analyzes Java 8 to 25 bytecodeApache-2.0 (0.1.0)

Gradle / Maven Central

testImplementation("io.github.tristankruse:archunitjava:0.1.0")
ArchitectureTest.java
Path root = Path.of("").toAbsolutePath().normalize();
StringBuilder output = new StringBuilder();
StringBuilder error = new StringBuilder();

int exit = new CliRunner().run(new String[] {
    "check",
    "--config", root.resolve("archunitjava.properties").toString(),
    "--root", root.toString()
}, output, error);

assertEquals(CliExitCode.SUCCESS.code(), exit, error.toString());

The ecosystem

Java, in context.

Java is a statically typed language that runs on the Java Virtual Machine and anchors a large ecosystem of enterprise, Android, data, and backend software. Maven and Gradle organize builds, while Spring and Jakarta EE are common application platforms. ArchUnitJava analyzes compiled bytecode as data, so target classes are never loaded or initialized during the check.

01

JVM portability and a mature enterprise ecosystem

02

Spring, Jakarta EE, Maven, Gradle, and JUnit 5

03

Compiled class and JAR analysis without application startup

Adoption snapshot

Public adoption, in context.

ArchUnitJava 0.1.0 is published on Maven Central for Maven and Gradle users. Central records download analytics, but only publishers can view them.

Package status
Published on Maven Central
Download totals are publisher-only
Reported history
Unavailable
Publisher-only analytics
Latest 30 days
Unavailable
Publisher-only analytics
GitHub stars
1
Snapshot of October 4, 2026

Capabilities

What ArchUnitJava brings to the test suite.

The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.

01

Class-directory, ordinary JAR, and multi-release JAR imports

02

Type, package, member, module, layer, and slice policies

03

Cycles, reachability, PlantUML, metrics, and baselines

04

Ordinary JUnit tests and optional JUnit Platform discovery

05

Console, JSON, SARIF, JUnit XML, and graph reports

06

Explicit incomplete-analysis and empty-selection behavior

Go deeper

Run architecture policy with ordinary JUnit.

The recommended public-beta path keeps policy in a strictly validated properties file and invokes the CLI bridge from a normal JUnit test. Compile first, then let the same test command used by the project enforce type or package dependency rules.

ArchitectureTest.java
@Test
void compiledApplicationRespectsItsPolicy() {
    Path root = Path.of("").toAbsolutePath().normalize();
    StringBuilder output = new StringBuilder();
    StringBuilder error = new StringBuilder();

    int exit = new CliRunner().run(new String[] {
        "check", "--config", "archunitjava.properties",
        "--root", root.toString(), "--result-format", "json"
    }, output, error);

    assertEquals(CliExitCode.SUCCESS.code(), exit, error.toString());
}

Documentation highlights

Work with ArchUnitJava beyond the quickstart.

ArchUnitJava 0.1.0 is a public beta on Maven Central. It imports compiled Java as data, projects an immutable dependency model, evaluates deterministic policies, and preserves structured evidence for JUnit and CI.

01

Import compiled Java without loading it

Point the importer at class directories, classpaths, or ordinary and multi-release JARs after the target project has compiled.

  • Target classes are never loaded or initialized; bytecode is parsed as untrusted data.
  • The tested corpus covers javac bytecode from Java 8 through Java 25 while the analyzer itself runs on JDK 25.
  • Missing external types remain visible as incomplete analysis instead of being guessed or silently discarded.
02

Choose the policy surface that fits the team

A strict properties interface covers common type and package dependency boundaries, while the Java API opens the complete model.

  • Rules cover dependencies, naming, inheritance, annotations, member access, cycles, layers, slices, JPMS modules, reachability, coverage, diagrams, and presets.
  • Empty selections fail by default, and incomplete analysis is distinct from a passing or failing architecture policy.
  • Reviewed baselines let an established codebase reject new findings while existing architecture debt is removed deliberately.
03

Integrate with JUnit and delivery systems

The recommended public-beta workflow calls CliRunner from an ordinary JUnit test, with lower-level assertions and a JUnit Platform engine available when needed.

  • Add io.github.tristankruse:archunitjava:0.1.0 as a test dependency from Maven Central.
  • Render findings as console text, canonical JSON, SARIF, or JUnit XML and dependency graphs as DOT, Mermaid, D2, CSV, JSON, or standalone HTML.
  • The pre-1.0 Java API remains provisional, so minor versions may require reviewed migration work.
Read the complete documentation ↗

Release and compatibility

0.1.0 public beta

Version 0.1.0 is a published public beta suitable for evaluation and new architecture-test suites. Its pre-1.0 Java API may change between minor versions, and the established third-party ArchUnit library remains the mature default for production Java systems.

LanguageJava
Release0.1.0 public beta
RuntimeJDK 25; analyzes Java 8 to 25 bytecode
LicenseApache-2.0 (0.1.0)

Where it fits

Put boundaries next to the code they protect.

Common starting points for ArchUnitJava include the following project shapes.

Spring servicesMaven monoreposGradle buildsJPMS applications

Make the first boundary executable.

Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.

Start with ArchUnitJava ↗