Search code examples
javacommand-lineintellij-ideacompiler-warningsheadless

IntelliJ command line compiler


I'm searching for an automated way to collect all the IntelliJ static code analysis warnings (compiler and inspections) without having to run a UI and click on buttons. Ideally I'd like run the IntelliJ compiler from the command line and have it log all warnings into a file. Is this possible?


Solution

  • Taken from Working with IntelliJ IDEA Features from Command Line:

    To launch a code inspection from the command line, specify the following command line arguments:

    1. Path to the launcher: specify the full path to one of the following launchers (which reside under the bin directory of your IntelliJ IDEA installation):
      • For Windows: inspect.bat
      • For UNIX : inspect.sh
    2. Project file path is the full path to the *.ipr file or .idea directory of the project to be inspected.
    3. Inspection profile path is the full path to the profile, against which the project should be inspected. The inspection profiles are stored under USER_HOME\.IntelliJ IDEAXX\config\inspection
    4. Output path is the full path to an existing directory where the report will be stored.
    5. Options. You can specify: The directory to be inspected -d The verbosity level of output -vX, where X is 0 for quiet, 1 for noisy and 2 for extra noisy.

    Please note that you have to specify full paths, relative paths are not accepted.