The Problem
Java offers no language construct to define module hierarchies or restrict inter-package access. In large codebases this inevitably leads to tangled, spaghetti-like dependencies that violate information hiding.
CODERU enforces clean module boundaries directly in your package hierarchy — no separate config file, no custom DSL. Just four reserved package names and an automated rule checker.
Java's built-in package system doesn't prevent unwanted cross-module dependencies. CODERU closes that gap.
Java offers no language construct to define module hierarchies or restrict inter-package access. In large codebases this inevitably leads to tangled, spaghetti-like dependencies that violate information hiding.
CODERU stands for Common Dependency Rules. Four reserved
package names — api, impl, common,
factory — each carry precise access semantics that are checked
automatically at build time.
A design rule is worthless if violations go undetected. CODERU ships as a Maven plugin and a JUnit adapter so rule violations break the build, not just a code-review comment.
Place your classes into packages whose names follow the CODERU conventions and the tool infers all access rights automatically.
apiPublicly accessible from anywhere in the program — the stable interface of a module. Typically holds interfaces and value types.
implPrivate to the direct parent module only. Implementation details stay hidden from the rest of the codebase — enforced at build time.
commonShared utilities visible to all sibling modules (and their descendants), but not to unrelated parts of the tree.
factory
Can access all siblings including impl — the designated
place for wiring / dependency-injection logic without leaking internals.
CODERU targets intra-module structure — a complementary layer to existing tools.
| Tool | Scope | Definition location | Granularity |
|---|---|---|---|
| CODERU | Intra-module (inside a JAR) | Package names in source code | Any depth |
| OSGi / Jigsaw | Inter-module (between JARs) | Manifest / module-info | JAR level |
| Sonargraph / Structure101 | Architecture-level | Separate proprietary config | High-level |
| ArchUnit | Custom rules | JUnit test code | Pattern-based |
Add one plugin entry to your pom.xml and your next build will catch all violations.
<plugin>
<groupId>org.coderu</groupId>
<artifactId>coderu-maven-plugin</artifactId>
<version>1.2.16</version>
<executions>
<execution>
<id>coderu</id>
<goals><goal>test</goal></goals>
</execution>
</executions>
</plugin>
See the Usage Guide for incremental adoption strategies, package exclusions, and the JUnit adapter.