Skip to content

Command-line options

codeanalyzer-java is a Picocli command. Invoke it as a fat JAR (java -jar codeanalyzer-2.3.7.jar ...) or, if you built a native image, as codeanalyzer ....

Usage: codeanalyzer [-hvV] [--no-build] [--no-clean-dependencies]
[--include-test-classes] [-a=<analysisLevel>] [-b=<build>]
[-f=<projectRootPom>] [-i=<input>] [-o=<output>]
[-s=<sourceAnalysis>] [-t=<targetFiles>]...
Analyze java application.
FlagArgumentDescriptionDefault
-i, --inputpathPath to the project root directory to analyze.
-s, --source-analysisstringAnalyze a single string of Java source instead of a project. No build required.
-o, --outputpathDirectory to write analysis.json. If omitted, JSON is printed to stdout.stdout
-a, --analysis-level1 | 21 = symbol table only; 2 = symbol table + call graph.1
-b, --build-cmdstringCustom build command. When omitted at level 2, an auto build is used.auto
--no-buildflagDo not build the application; use already-compiled output.off
--no-clean-dependenciesflagDo not delete the downloaded _library_dependencies directory after analysis.off
-f, --project-root-pathpathPath to the root pom.xml / build.gradle (for multi-module projects).value of -i
-t, --target-filespathA file to (re)analyze incrementally; repeatable. Forces level 1.
--include-test-classesflagAlso compile/analyze test sources. (Hidden option.)off
-v, --verboseflagPrint logs to the console.off
-h, --helpflagShow help and exit.
-V, --versionflagPrint version information and exit.
  • -i points at a project directory on disk. This is the normal mode; dependencies are downloaded and (at level 2) the project is built.
  • -s passes Java source as a string. The symbol table is built directly from that snippet with JDK-only type resolution — no project, no build, no dependency download.

Exactly one of these is the analysis subject. -s takes precedence when both are present.

With -o, the analyzer writes <output>/analysis.json (creating the directory if needed). Without -o, the consolidated JSON goes to stdout — convenient for piping, and how the Python SDK can capture output without a temp file.

See Analysis levels. Level 2 implies a build unless you pass --no-build or a custom -b.

See Incremental analysis. Repeat the flag for multiple files. Forces level 1; merges into an existing analysis.json when one is present in the output directory.

The command exits non-zero on failure. Run with -v to see the underlying logs (build invocation, dependency download, parse problems, WALA progress) when diagnosing a failed run.

See worked invocations in Examples.