Sonar-maven-plugin error for resource-only JARs

Hello everyone,

Our DevOps provider upgraded from the sonar-maven-plugin from to

We have a large multi-module Maven project with many submodules. All “normal” submodules with source code build and run through SQ just fine. However, we have several resource-only JAR modules which only contain a “src/main/resources” directory and no “src/main/java”. These worked fine before the upgrade, but now cause an error during the build.

[2023-09-29T09:13:05.821Z] [2023-09-29T09:13:05.821Z] [ERROR] Failed to execute goal **org.sonarsource.scanner.maven:sonar-maven-plugin:** (default-cli) on project XXX: **The directory** '/home/jenkins/workspace/.../**src/main' does not exist for Maven module xxx:jar:23.x-SNAPSHOT** . Please check the property sonar.sources -> [Help 1].

In there was a change for MSONAR-190 which might be related.


IMHO the plugin should at most warn about the missing directory but not fail with error.

NOTE: as workaround we have added “src/main/java/.gitkeep” but this creates a bit of unnecessary clutter.

Unfortunately I cannot create an issue without an enterprise account. :frowning:

Cheers, Jeff

1 Like

Hello @JWT007,

Welcome to the Sonar Community and thank you for reporting this issue. I’m glad that you found a temporary workaround.

I’ve been trying to reproduce the issue within an invoker-test with the following setup:

        ---> src/resources/file.txt
        ---> pom.xml

The test successfully verifies that the sonar.sources property contains only the path to pom.xml and no error is logged.

In order to be able to help, could you provide a small reproducer? It would be nice to have a zip file with a small project facing the issue and the exact command you execute for triggering the scan.