Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
badgersrc opened this issue Feb 22, 2023 · 1 comment
Open

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

badgersrc opened this issue Feb 22, 2023 · 1 comment

Comments

@badgersrc
Copy link

badgersrc commented Feb 22, 2023

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!

@jborgers
Copy link
Owner

jborgers commented Apr 24, 2024

Hi @badgersrc , is this still a problem with Sonar 9.9 and sonar-pmd plugin 3.5.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants