# tcurdt/jdependency architecture

> Architecture diagram of the GitHub repository tcurdt/jdependency, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tcurdt/jdependency
- Repository: https://github.com/tcurdt/jdependency

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors
    Dev([Developer]):::actor
    EU([End User]):::actor

    %% Source Control & CI/CD
    subgraph "Source Control & CI/CD"
        GitHub[(GitHub Repo)]:::storage
        subgraph "CI/CD Workflows"
            CI1([ci.yml]):::process
            CI2([release-docs.yml]):::process
            CI3([release-to-maven-central.yml]):::process
        end
    end

    %% Build & Publish Processes
    subgraph "Build & Publish"
        Build([Maven Build]):::process
        Test([Test Suite Run]):::process
        Docs([Generate Docs]):::process
        Publish([Publish to Maven Central]):::process
        pom([pom.xml]):::config
        docker([docker.sh]):::config
    end

    %% jdependency Modules
    subgraph "jdependency Modules"
        subgraph "CLI Layer"
            Console(["Console.java"]):::module
        end
        subgraph "Core API Layer"
            Clazz(["Clazz.java"]):::module
            Clazzpath(["Clazzpath.java"]):::module
            ClazzpathUnit(["ClazzpathUnit.java"]):::module
        end
        subgraph "ASM Infrastructure"
            Adapter(["DependenciesClassAdapter.java"]):::module
        end
        subgraph "Utility Library"
            DU(["DependencyUtils.java"]):::module
            SU(["StreamUtils.java"]):::module
        end
    end

    %% Test Suite & Fixtures
    subgraph "Test Suite & Fixtures"
        subgraph "Unit Tests"
            T1(["ClazzpathTestCase.java"]):::test
            T2(["ClazzpathUnitTestCase.java"]):::test
            T3(["DependencyUtilsTestCase.java"]):::test
        end
        subgraph "Fixtures"
            F1(["resources-src/"]):::storage
            F2(["resources/"]):::storage
        end
    end

    %% External Artifact Repo
    MavenCentral[(Maven Central)]:::storage

    %% Relationships
    Dev -->|commits code| GitHub
    GitHub -.->|triggers| CI1
    GitHub -.->|triggers| CI2
    GitHub -.->|triggers| CI3

    CI1 -->|runs| Build
    CI1 -->|runs| Test
    CI2 -->|runs| Docs
    CI3 -->|runs| Publish

    Build -->|reads| pom
    Build -->|uses| docker
    Publish -->|publishes| MavenCentral

    %% Runtime flow
    EU -->|runs CLI| Console
    Console -->|invokes| Clazzpath
    Clazzpath -->|loads units| ClazzpathUnit
    Clazzpath -->|parses bytecode| Adapter
    Adapter -->|uses| Clazz
    Clazzpath -->|uses| DU
    Clazzpath -->|uses| SU

    %% Tests use modules and fixtures
    T1 -->|tests| Clazzpath
    T2 -->|tests| ClazzpathUnit
    T3 -->|tests| DU
    T1 -->|uses fixtures| F1
    T1 -->|uses fixtures| F2

    EU -->|adds dependency| MavenCentral

    %% Click Events
    click GitHub "https://github.com/tcurdt/jdependency/tree/master/.github/workflows/"
    click CI1 "https://github.com/tcurdt/jdependency/blob/master/.github/workflows/ci.yml"
    click CI2 "https://github.com/tcurdt/jdependency/blob/master/.github/workflows/release-docs.yml"
    click CI3 "https://github.com/tcurdt/jdependency/blob/master/.github/workflows/release-to-maven-central.yml"
    click pom "https://github.com/tcurdt/jdependency/blob/master/pom.xml"
    click docker "https://github.com/tcurdt/jdependency/blob/master/docker.sh"
    click Console "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/Console.java"
    click Clazz "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/Clazz.java"
    click Clazzpath "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/Clazzpath.java"
    click ClazzpathUnit "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/ClazzpathUnit.java"
    click Adapter "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/asm/DependenciesClassAdapter.java"
    click DU "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/utils/DependencyUtils.java"
    click SU "https://github.com/tcurdt/jdependency/blob/master/src/main/java/org/vafer/jdependency/utils/StreamUtils.java"
    click T1 "https://github.com/tcurdt/jdependency/blob/master/src/test/java/org/vafer/jdependency/ClazzpathTestCase.java"
    click T2 "https://github.com/tcurdt/jdependency/blob/master/src/test/java/org/vafer/jdependency/ClazzpathUnitTestCase.java"
    click T3 "https://github.com/tcurdt/jdependency/blob/master/src/test/java/org/vafer/jdependency/DependencyUtilsTestCase.java"
    click F1 "https://github.com/tcurdt/jdependency/tree/master/src/test/resources-src/"
    click F2 "https://github.com/tcurdt/jdependency/tree/master/src/test/resources/"

    %% Styles
    classDef actor fill:#FFD966,stroke:#333,stroke-width:1px
    classDef storage fill:#C9DAF8,stroke:#333,stroke-width:1px
    classDef process fill:#D5A6BD,stroke:#333,stroke-width:1px
    classDef config fill:#B6D7A8,stroke:#333,stroke-width:1px
    classDef module fill:#F9CB9C,stroke:#333,stroke-width:1px
    classDef test fill:#EAD1DC,stroke:#333,stroke-width:1px
```
