Java

Configuration - .deepsource.toml

This section covers configuration details specific to the Java analyzer. Please ensure that you have read the general configuration guide first.

The Java analyzer supports Gradle, Maven and Bazel projects. There is no difference in configuration between them, and all types of projects can be initialized through the simple workflow of the DeepSource configuration generator.

name

  • Type: String
  • Presence: mandatory
  • Description: Shortcode of the analyzer.
  • Example:
name = "java"

enabled

  • Type: Boolean
  • Presence: optional
  • Description: Toggle whether this analyzer should be run.
  • Example:
enabled = true

meta

  • Type: Table
  • Presence: mandatory
  • Description: Additional data used to configure the analyzer.
  • Example:
[analyzers.meta]
  runtime_version = "8"

runtime_version

  • Type: String
  • Presence: mandatory
  • Description: The Java runtime version to use when running the analyzer. OpenJDK versions 8 to 17 are currently supported.
  • Aliases: java_version
  • Example:
[analyzers.meta]
  runtime_version = "13"

if runtime_version is not specified, or is the wrong Java version, analysis may fail. Specify the Java version you use locally or in CI for best results.

skip_doc_coverage

  • Type: Array

  • Presence: optional

  • Description: Specify which artifacts to skip when calculating documentation coverage.

  • Available Values: test, class, constructor and nonpublic

    • test - Ignore documentation coverage within tests
    • class - Ignore class documentation coverage
    • constructor - Ignore constructor documentation coverage
    • nonpublic - Ignore documentation for declarations that aren't public
  • Default Value: [ "test" ]

  • Example:

skip_doc_coverage = [ "nonpublic", "test" ]

If skip_doc_coverage is set, it will override any default configuration. That is, if this key is set, and you wish to ensure documentation coverage is skipped for elements that are skipped by default (like tests), you must specify those as well as the additional elements you wish to skip.

legacy ()

  • Type: Boolean
  • Presence: optional
  • Description: Use the Java analyzer in legacy mode. This will build your project before analysis and may detect more issues. This comes with a few caveats; analysis may take longer and might time out for large projects.
  • Example:
[analyzers.meta]
  legacy = true
Legacy mode has been removed from DeepSource, and this option will be ignored if present in your config. Remove this option if you have it enabled.

Sample config

version = 1

[[analyzers]]
name = "java"
enabled = true

  [analyzers.meta]
  runtime_version = "8"