Examples
A collection of complete, copy-pasteable invocations. Replace codeanalyzer-2.3.7.jar with your built JAR path (or codeanalyzer if you compiled a native binary).
Symbol table only (fast, no build)
Section titled “Symbol table only (fast, no build)”Parse a project and emit the symbol table. No project build required:
java -jar codeanalyzer-2.3.7.jar \ -i /path/to/commons-cli \ -a 1 \ -o ./output# -> ./output/analysis.json with symbol_tableFull analysis with call graph
Section titled “Full analysis with call graph”Symbol table plus the WALA call graph. The project is built automatically:
java -jar codeanalyzer-2.3.7.jar \ -i /path/to/commons-cli \ -a 2 \ -o ./output \ -v# -> ./output/analysis.json with symbol_table + call_graphSingle source string (no project, no build)
Section titled “Single source string (no project, no build)”Analyze a snippet directly; output goes to stdout:
java -jar codeanalyzer-2.3.7.jar \ -s "public class HelloWorld { public static void main(String[] args) {} }" \ -a 1Pre-built project (skip the build)
Section titled “Pre-built project (skip the build)”If the project is already compiled, skip the build step for a faster level-2 run:
java -jar codeanalyzer-2.3.7.jar \ -i /path/to/project \ -a 2 \ --no-build \ -o ./outputCustom build command
Section titled “Custom build command”Use your own build instead of the auto build:
java -jar codeanalyzer-2.3.7.jar \ -i /path/to/project \ -a 2 \ -b "mvn -q clean package -DskipTests" \ -o ./outputIncremental analysis (target files)
Section titled “Incremental analysis (target files)”Re-analyze just two files and patch them into an existing analysis.json:
java -jar codeanalyzer-2.3.7.jar \ -i /path/to/project \ -t src/main/java/org/apache/commons/cli/Option.java \ -t src/main/java/org/apache/commons/cli/Options.java \ -o ./outputThe named files are tagged is_modified: true in the merged output. See Incremental analysis.
Multi-module project
Section titled “Multi-module project”Analyze a submodule while building from the reactor root:
java -jar codeanalyzer-2.3.7.jar \ -i /path/to/project/web-module \ -f /path/to/project/pom.xml \ -a 2 \ -o ./outputPipe stdout into a tool
Section titled “Pipe stdout into a tool”Omit -o to stream JSON to stdout and process it inline:
java -jar codeanalyzer-2.3.7.jar -i /path/to/project -a 1 \ | jq '.symbol_table | keys | length'# prints the number of analyzed source filesFrom Python via CLDK
Section titled “From Python via CLDK”If you’d rather not manage the JAR yourself, the CLDK SDK invokes it for you:
from cldk import CLDKfrom cldk.analysis import AnalysisLevel
analysis = CLDK(language="java").analysis( project_path="commons-cli", analysis_level=AnalysisLevel.call_graph,)print(len(analysis.get_classes()), "classes")print(analysis.get_call_graph()) # -> networkx.DiGraphSee Python SDK integration for details.