Project contains .java files, please provide compiled classes with sonar.java.binaries property

Hello Team,

I’m trying to run the build in Bitbucket pipeline and receiving the following error:
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project aem-content: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property. →

I tried setting up all the possible values for sonar.java.binaries property but no luck.
-Dsonar.java.binaries=target/**/*.class (OR) **/target/classes (OR)target/classes

This is my project structure:

[INFO] AEM Content ........................................ FAILURE [ 22.740 s]
[INFO] AEM Content - Core ................................. SKIPPED
[INFO] AEM Content - UI content ........................... SKIPPED

Could you please help me in fixing the issue.

Thanks!!

Hi,

If you build before analysis, the binaries will be picked up automatically from the Maven context. Something like

mvn clean install sonar:sonar

 
HTH,
Ann