How tcurdt/jdependency works
Project type and purpose
• jdependency is a Java library and command-line application (Console.java) that reads one or more JAR files, examines their bytecode (via ASM), and reports:
• missing classes
• clashed or version-conflicting classes
• unused classes
• It is packaged and released via Maven Central; CI/CD pipelines (GitHub Actions) build, test, generate docs, and publish artifacts.
File structure
• Top-level:
• pom.xml – Maven build descriptor
• docker.sh – wrapper script for containerized runs
• .github/workflows/*.yml – CI/CD pipelines (build, test, release, docs)
• Source:
• src/main/java/org/vafer/jdependency:
– core domain: Clazz, Clazzpath, ClazzpathUnit
– Console.java: CLI entry point
– asm: DependenciesClassAdapter (bytecode visitor)
– utils: common helpers (I/O, streams)
• src/test: unit tests and sample JAR fixtures under test/resources-src
• No GUI or network layers—pure-Java library + CLI.
README for architecture clues
• Shows usage patterns: create a Clazzpath, add ClazzpathUnit for each JAR, call API methods to extract sets of Clazz objects.
• Highlights ASM dependency for bytecode parsing.
Main components & interactions
a. Components:
1. Developer & Source Control (GitHub)
2. CI/CD pipelines (GitHub Actions)
3. Maven Build (pom.xml)
4. jdependency Core API:
– ClazzpathEngine (uses Clazz, ClazzpathUnit)
– Bytecode Parser (ASM adapter)
– Utility library
5. CLI Layer (Console.java)
6. Test Suite & Fixtures
7. Artifact Repository (Maven Central)
8. End User (consumes CLI or library)
b. Relationships:
• Developer commits → GitHub repo → triggers CI pipelines
• CI → Maven build → run tests → generate docs → publish to Maven Central
• At runtime, End User runs the CLI or calls Core API from their code
• Core API uses ASM adapter to scan JAR bytecode → builds model (Clazz, ClazzpathUnit) → computes results → Console prints to stdout
c. Architectural patterns & principles:
• Layered architecture:
– CLI / Presentation layer
– Domain layer (dependency-analysis engine)
– Infrastructure layer (ASM for bytecode reading, utilities)
• Single-responsibility per class (e.g., DependenciesClassAdapter only instruments bytecode visits)
• Modular packaging: each package groups related classes (core vs utils vs asm)
d. Key technologies:
• Java SE (8+)
• ASM bytecode framework
• Maven for build & dependency management
• JUnit (tests)
• GitHub Actions (CI/CD)
• Docker (optional wrapper)
Putting it all together
• From GitHub → CI/CD workflows → Maven build/test/docs → Maven Central
• Center: Code modules:
[CLI Layer] → [Core API Layer] → [ASM Infrastructure]
• Below: Test Suite & Fixtures