[WARNING] No input file found for xxx file

hi, there
I try to genenrate the pmd report and upload to sonarcloud, followings are some of the pmd report for Java :

<file name="/opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/QueryableRALStatementAssert.java">
<violation beginline="66" endline="100" begincolumn="19" endcolumn="5" rule="CognitiveComplexity" ruleset="Design" package="org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl" class="QueryableRALStatementAssert" method="assertIs" externalInfoUrl="https://pmd.github.io/pmd-6.53.0/pmd_rules_java_design.html#cognitivecomplexity" priority="3">
The method 'assertIs(SQLCaseAssertContext, QueryableRALStatement, SQLParserTestCase)' has a cognitive complexity of 16, current threshold is 15
</violation>
</file>
<file name="/opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/tcl/impl/LockStatementAssert.java">
<violation beginline="46" endline="72" begincolumn="19" endcolumn="5" rule="CognitiveComplexity" ruleset="Design" package="org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.tcl.impl" class="LockStatementAssert" method="assertIs" externalInfoUrl="https://pmd.github.io/pmd-6.53.0/pmd_rules_java_design.html#cognitivecomplexity" priority="3">
The method 'assertIs(SQLCaseAssertContext, LockStatement, LockStatementTestCase)' has a cognitive complexity of 16, current threshold is 15
</violation>
</file>

when I try to upload by mvnw sonar:sonar I got following warnings, and after I check , these files DO Exists.

...
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/external/ExternalSQLParserIT.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalSQLParserIT.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalUnsupportedSQLParserIT.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dcl/DCLStatementAssert.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/DDLStatementAssert.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/QueryableRALStatementAssert.java. No PMD issue will be imported on this file.
[WARNING] No input file found for /opt/investigation/pmd/shardingsphere-pmd-sonarcloud/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/tcl/impl/LockStatementAssert.java. No PMD issue will be imported on this file.

I try to set the abusolute path for sonar.java.pmd.reportPaths, and that does not work.

Hey there.

Are you generating the PMD report immediately before running SonarCloud analysis? What command to you use to generate it?

mvn pmd:pmd

I saw the generated xml file and then execute the sonar:sonar command

Thanks.

Are the files referenced visible in SonarCloud (i.e. you are sure it is being analyzed and not excluded, skipped…)

no, it’s not visible in SonarCloud.
after test, no matter absolute path or relative path will not be accepted in sonar-plugin.
seems that currently the sonar-plugin only support single module project, it will scan all files in that module when start, and then save the file lists in cache.
if it found any java file in pmd report, it will search in cache and check if the file exists

seems the maven plugin doesn’t support read the pmd report in multiple module project.

If the code itself isn’t analyzed by SonarCloud (before considering whether or not there is an external issues report generated by a tool like PMD), that’s the problem you’ll need to address first.

The SonarScanner for Maven supports multi-module projects. You can find an example here.

it’s not “sonar scanner doesn’t support multiple-module”, it’s “sonar scanner doesn’t support pmd report for multiple-module”

and this issue is quite simple:
execute maven command mvn pmd:pmd, there will be a pmd.xml file generated. it contains some files which break the pmd rules with absolute path.
but sonar scanner can not recognize these absolute path even these files are really exist.

this also happens on spotbugs report like followings:

[INFO] Importing /home/runner/work/shardingsphere-spotbugs/shardingsphere-spotbugs/mode/type/standalone/repository/provider/jdbc/target/spotbugsXml.xml
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQL.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQL.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQL.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQL.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQL.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQL.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java'. No SpotBugs issues will be imported on this file.
Warning:  No input file found for 'org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java'. No SpotBugs issues will be imported on this file.

And I want to go back to this question:

Ignoring the question of the PMD / Spotbugs report, is org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java analyzed by SonarCloud?

sonar scanner “READ” the report and then can not find the corresponding files. what you mean “analyzed” in this situation ? it even can not read the file, then how to analyzed the file ?

I am trying to understand if when you browse the Code tab of your SonarCloud project, you see the files that are being referenced by the PMD / Spotbugs report (as in, they are already being analysed by SonarCloud, with which the PMD / Spotbugs report would add any additional findings).