Java2Graph is a high-performance, memory-optimized AST parser and Code Property Graph (CPG) generator for Java codebases. Developed by Neuvem, it is specifically designed to parse massive Java monoliths (e.g., Spring Framework, Apache Kafka) and export heavily deduplicated structural graphs directly into a binary LadybugDB database.
- Blazing Fast Extraction: Uses a highly optimized Heuristic
fastResolvepipeline to deduce call chains and inheritance relationships in seconds, bypassing the crippling GC-overhead of traditional Deep Symbol Solvers. - Native Lombok Support: Natively integrates
DelombokPassto dynamically proxy source roots and reconstruct missing AST entities (like Getters/Setters generated by@Data) before parsing, with built-in fallbacks. - Memory Stable: Sequentially isolated AST streams and aggressive
ClassLoaderproxying guarantee successful extraction on massive 15,000+ file projects without encountering OutOfMemory errors. - Data Integrity: Global
Set-based hashing models natively guarantee absolutely zero duplicate edges are written to the database, even when processing highly misconfigured multi-module source roots. - Zero-Dependency Native Binary: Ships via
jpackagealongside a custom, minified JRE containing only the exact JVM modules required.
- JDK 17
- Maven 3+
To build a standard Java fat-jar:
mvn clean package -DskipTestsTo build a fully encapsulated native operating system application (bundled with a minified JRE):
./build-standalone.shYour standalone binary will be available at dist/java2graph.
To query the databases generated by Java2Graph, you should install the Ladybug CLI (lbug).
macOS (via Homebrew):
brew install ladybugLinux / Generic Shell (via Install Script):
curl -s https://install.ladybugdb.com | bashManual Installation:
You can also download precompiled binaries directly from the Ladybug Releases page. Extract the archive and ensure the lbug binary is in your system PATH.
If using the compiled .jar:
java -jar target/java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar -s <path_to_source> -d <output_db_dir> [OPTIONS]If using the Standalone App Image:
./dist/java2graph/java2graph -s <path_to_source> -d <output_db_dir> [OPTIONS]| Flag | Name | Description | Default |
|---|---|---|---|
-s, --src |
Source Directory | (Required) Path to the Java source code directory. | N/A |
-j, --jars |
Dependencies | Paths to dependency jars or directories (comma-separated or repeatable). | N/A |
-d, --out-db |
Database Output | Directory or path to output the Ladybug DB files. | . |
-c, --out-csv |
CSV Output | Directory to output the CSV files. | . |
-l, --lombok |
Enable Lombok | Enable Lombok preprocessing before parsing. | false |
-f, --fast |
Fast Resolution | Use fast AST heuristic resolution instead of exact symbol solver. | false |
-t, --threads |
Thread Count | Number of threads for parallel processing. | 4 |
--help |
Help | Show standard help message and exit. | N/A |
--version |
Version | Show version information and exit. | N/A |
Once the extraction completes, the data is structured natively for LadybugDB queries via Open Cypher.
Discover Unresolved Method Calls:
MATCH (caller:Method)-[c:Calls]->(callee:Method)
WHERE callee.id CONTAINS "<unresolvedNamespace>"
RETURN count(c);Find Interface Implementations:
MATCH (c:Class)-[:Implements]->(i:Interface)
RETURN c.fqn, i.fqn;Java2Graph is developed and maintained by Neuvem.