SonarJava Checkstyle import should only warn on missing files

Environment:
Sonar LTS 7.9 with latest SonarJava plugin

Multiple sonar.java.checkstyle.reportPaths configured for ./target/checkstyle-result.xml and ./target/checkstyle-ktlint.xml

Running this results in ERROR message with stracktrace:

[ ERROR ] Failed to import external issues report: /home/jenkins/agent/workspace/foo/./target/checkstyle-ktlint.xml 00:26:28.385 java.io.FileNotFoundException: /home/jenkins/agent/workspace/foo/./target/checkstyle-ktlint.xml (No such file or directory) 00:26:28.385 at java.base/java.io.FileInputStream.open0(Native Method) 00:26:28.385 at java.base/java.io.FileInputStream.open(FileInputStream.java:219) 00:26:28.385 at java.base/java.io.FileInputStream.(FileInputStream.java:157) 00:26:28.385 at org.sonar.java.externalreport.CheckstyleSensor.importReport(CheckstyleSensor.java:65) 00:26:28.385 at org.sonar.java.externalreport.CheckstyleSensor.lambda$execute$1(CheckstyleSensor.java:61)

As not all maven modules provide all the checkstyle reports, the expected behavior would be to print only a WARNING without stacktrace as the Jacoco Plugin does.

Kind regards,
Michael

Hi,

Thanks for the feedback, indeed this is an issue in the context of multimodule. This is the whole story about finding out if this is expected or a typo in the configuration.
Ticket created to handle the issue : https://jira.sonarsource.com/browse/SONARJAVA-3147

In the meantime, one way to work around this issue is also to configure this feature via maven profile to set up the path property and activate it only if the report file is present :
https://maven.apache.org/guides/introduction/introduction-to-profiles.html

  <profile>
    <activation>
      <file>
        <exists>target/my-report-path</exists>
      </file>
    </activation>
    ...
  </profile>
</profiles>