The angular repo has Java Files and we tried to exclude the Java classes using sonar.coverage.exclusions
ERROR: Error during SonarScanner execution
org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75)
at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:317)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:169)
You said you tries to exclude the Java classes using sonar.coverage.exclusions.
This property only excludes files from test coverage computation, not from the whole analysis.
The error message advises to use another property to exclude the Java files from the analysis: sonar.exclusions.
Have you tried using that other property instead?
If you need help configuring the exclusion pattern, here is the documentation.
The problem is the angular repo is a mono repo and the bitbucket pipelines stops at the end without giving any analysis due to “container exceeding memory limit”
Tried increasing the memory and pass SONAR_SCANNER_OPTS: -Xmx4096m
The memory consumption issue is a very known one and using SONAR_SCANNER_OPTS does not increase the memory available to the container.
The solution is explained on the link on that post.
In short:
Add the size: 2x parameter to the pipeline step, to give more memory to the step
Allocate that memory to the docker container (you can increase the value up to 7128 with a 2x step)
I have the size:2x parameter in every step, but the service memory in definitions @ 2048 it stops at the after the code is scanned and before the quality gate complaining of memory.
I did increase to 7128 it stops in the beginning of the pipeline.
Have you tried any other value between 2048 and 7128, to find one big enough to run the analysis but small enough to be supported by the pipeline environment?
Could you please post the full logs ?
I have a question, submitted a scan last night, the pipeline says it is failed because the sonar-quality-gate was not run.
When I look at the background tasks of the project it says successful and there is no coverage report. Can you take a look at the below id and let me know why the quality gate was not run and why the pipelines say it is failed.
Is it on the same project or on another one?
If it’s another issue, could you please open another thread? It would help keeping this one clean and the investigation easier.
Could you please post the full logs, complete, from the start of the step to the error?
Have you tried any other values, to see if a compromise with the apparently invalid 7128, and the too small 4096 can be found?
I see a lot of files on your project. Have you tried narrowing down the analyzed files, by excluding some directories, to find if a very big file or directory could cause the issue?
If you can isolate a given file or directory that makes the analysis fail, then we would be able to investigate further.