Configuring Service-Lint

Service-Lint reads configuration from up to three places: a YAML config file, Maven plugin parameters, and command-line options. This page describes each and how they interact.

The Configuration File (servicelint-config.yml)

By default Service-Lint looks for a file named servicelint-config.yml in the project root. You can point at a different location with the configFile plugin parameter or the CLI --config-file option.

The file lists rules and whether each is enabled:

rules:
  - name: ChangelogVersion
    enabled: true
  - name: DependencyUpdates
    enabled: true
  - name: ParentVersionConsistencyRule
    enabled: false
  - name: SwaggerContractVersion
    enabled: true

Key behaviors:

  • Rules are referenced by name (as shown by list-rules), not by SL ID.

  • If no config file is present, all rules run.

  • If a rule is not listed, it is enabled by default. To turn a rule off you must explicitly set enabled: false.

  • You can also attach ignoredModules to a rule entry to suppress violations for specific paths — see Ignoring Modules.

Maven Plugin Parameters

Configure the plugin in pom.xml:

<plugin>
  <groupId>gov.va.mobile.tools</groupId>
  <artifactId>service-lint-maven-plugin</artifactId>
  <version>${service-lint.version}</version>
  <configuration>
    <configFile>path/to/servicelint-config.yml</configFile>
    <failOnViolation>true</failOnViolation>
    <parallel>true</parallel>
    <disabledRules>
      <disabledRule>DependencyUpdates</disabledRule>
      <disabledRule>ServiceLintVersion</disabledRule>
    </disabledRules>
  </configuration>
</plugin>

Every parameter can also be supplied on the command line:

mvn service-lint:check \
  -DconfigFile=path/to/servicelint-config.yml \
  -DfailOnViolation=false \
  -Dparallel=false \
  -DdisabledRules=DependencyUpdates,ServiceLintVersion
Parameter Description Default

service-lint.skip

Skip execution of Service-Lint entirely. See Skipping & Disabling.

false

configFile

Path to the configuration file.

servicelint-config.yml in project root

failOnViolation

Fail the build when violations are found.

true

parallel

Execute rules in parallel. Set to false if CI hits memory limits.

true

disabledRules

Rule names to disable (case-insensitive match against the rule name).

(empty)

CLI Options

The CLI accepts the same ideas as flags:

java -jar service-lint-cli-1.4.4.jar check \
  --project-path /path/to/project \
  --config-file /path/to/servicelint-config.yml \
  --parallel false \
  --disable-rules ChangelogVersion,DependencyUpdates

See CLI Usage for all commands.

How the Sources Combine

  • Config file decides the baseline enabled/disabled state of each rule and any per-rule ignoredModules.

  • disabledRules / --disable-rules turns rules off regardless of the config file — a convenient one-off override without editing YAML.

  • Plugin <configuration> and command-line -D / flags set the operational parameters (configFile, failOnViolation, parallel). Command-line values override the POM.

Prefer the config file for durable, reviewed policy (what your team always wants on/off), and use disabledRules / CLI flags for temporary, local overrides.

Keeping Rules Current

Because rules are discovered via Java’s ServiceLoader, adding the newest service-lint-rules dependency (version RELEASE) makes new rules available automatically — even with an older plugin. New rules are enabled by default, so update your config file if you want to opt out of any.