[tutorial] Taikai Introduction (based on ArchUnit)
Note: This page is an AI-generated (gpt-5-mini-2025-08-07) translation from Traditional Chinese and may contain minor inaccuracies.
📌 Introduction
Taikai is a Java architecture-checking tool based on ArchUnit. It provides pre-built rules to check code architecture, supports creating shared Rules Profile for reuse across multiple projects, and automatically verifies via unit tests whether code meets architectural requirements.
🚀 Introducing Taikai
Taikai is a Java code architecture-checking library that can be used to inspect dependencies and layering between packages and classes, check for cyclic dependencies, and more. Taikai is based on ArchUnit, provides rules commonly needed by popular frameworks, and offers Rules Profile so architecture rules can be reused. The Rules currently provided include:
- Java Rules
- Logging Rules
- Test Rules
- Spring Rules
- Quarkus Rules
Implementation
There are two types of repositories in total:
shared-architecture-rulesthat defines common rules (Rules Profile)- A repo for developing services
Shared Architecture Rules
- A simple Rule has been implemented and can be found in
shared-architecture-rules-0.1.0-SNAPSHOT - It imposes simple restrictions, such as disallowing the use of Deprecated APIs and ensuring a Method’s params do not exceed 5
1 | package com.hsiangjenli; |
Checking rules within the repo
Implementation details can be found at quarkus-demo-architecture-rules
Setting up pom.xml
Because the shared Architecture Rules are only on GitHub and not published to Maven, remember to use jitpack, and make sure the tag of
shared-architecture-rulesmatches the one on GitHub
1 | <repositories> |
Example: code that violates the rules
1 | // ManyParameters.java |
Test the Architecture
1 | // ArchitectureTest.java |
1 | mvn test |
You can see the test fails because the method in ManyParameters has parameters exceeding the maximum value 5 set in ArchitectureRules.BASE_JAVA_RULES.

🔁 Key takeaways
- Taikai is a Java architecture-checking tool based on ArchUnit, providing pre-built rules for frameworks like Java, Spring, and Quarkus
- Supports reusable Rules Profile so a shared rule set can be created and used across multiple projects
- Runs checks via unit tests; when rules are violated the tests fail, ensuring code conforms to architectural requirements
🔗 References
- DeepWiki
[tutorial] Taikai Introduction (based on ArchUnit)
https://hsiangjenli.github.io/blog/tutorial-taikai-based-on-archunit.en/