sonar-pmd icon indicating copy to clipboard operation
sonar-pmd copied to clipboard

can't scan java source that uses java.sql.Connection

Open badgersrc opened this issue 1 year ago • 1 comments

I'm struggling to run sonar against code that uses packages from java.sql

debian 162424 $ echo $SONAR_ARGS
-Dsonar.core.serverBaseURL=http://sonar:9000 -Dsonar.projectKey=XXXXXX -Dsonar.projectName=XXXXXXXXXX  -Dsonar.gitlab.max_blocker_issues_gate=-1 -Dsonar.gitlab.max_critical_issues_gate=-1 -Dsonar.host.url=https://XXXXXXXXXXX:443 -Dsonar.token=3XXXXXXX -Dsonar.gitlab.project_id=YYYYYYYYYYYY -Dsonar.gitlab.commit_sha=1234 -Dsonar.gitlab.ref_name=develop
debian 162425 $
debian 162425 $ mvn sonar:sonar $SONAR_ARGS

[ERROR] Fail to execute PMD. Following file is ignored: src/XXXXXXXXXX
net.sourceforge.pmd.PMDException: Error while processing file:///XXXXXXXXBrokerForDB2.java

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project YYYYYYY: Execution default-cli
of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java/sql/Connection

This is a local reproduction of a problem in a gitlab pipeline.

The java version is 11. I guess I have to add the java module java.sql to the execution somewhere, but I can't work out where. Setting an argline in the sonar-maven-plugin def in the pom doesn't seem to have any effect and I can't see where I can set it in the administration console. Adding --add-modules java.sql to MAVEN_OPTS changes nothing, JAVA_TOOLS too. Any ideas?

mvn test and mvn pmd:pmd run fine.

sonar maven plugin 3.9.1.2184 . sonar - Community EditionVersion 7.9.1 (build 27448)

Thanks!

badgersrc avatar Feb 22 '23 17:02 badgersrc