Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Your project contains .java files #17

Open
firstsko opened this issue Jul 14, 2020 · 2 comments
Open

Your project contains .java files #17

firstsko opened this issue Jul 14, 2020 · 2 comments

Comments

@firstsko
Copy link

INFO: EXECUTION FAILURE

47 | INFO: ------------------------------------------------------------------------
48 | INFO: Total time: 6.901s
49 | INFO: Final Memory: 18M/119M
50 | INFO: ------------------------------------------------------------------------
51 | ERROR: Error during SonarQube Scanner execution
52 | 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.
53 | at org.sonar.java.JavaClasspath.init(JavaClasspath.java:64)
54 | at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280)
55 | at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:149)
56 | at org.sonar.java.JavaSquid.(JavaSquid.java:81)
57 | at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:102)
58 | at

@Hpareek07
Copy link

Any update on this issue ?

@yahaha-yes
Copy link

yahaha-yes commented May 7, 2022

There are two way to deal the problem.
1、 Add the sonar-scanner.properties to the project root path and set usingProperties:true

  steps:
  - name: code-analysis
    image: aosapps/drone-sonar-plugin
    settings:
      sonar_host:
        from_secret: sonar_host
      sonar_token:
        from_secret: sonar_token
      usingProperties: true

2、Repackage the docker image, here is my Dockerfile and sonar-scanner.properties
Note: I use the DroneCI to do the code-analysis so the sonar.java.binaries is /drone/src/target/classes

## Dockerfile

FROM harbor.sz/library/drone-sonar-plugin:latest
ARG SONAR_VERSION=4.7.0.2747
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
COPY ./sonar-scanner.properties /bin/${SONAR_SCANNER}/conf
ENV PATH $PATH:/bin/${SONAR_SCANNER}/bin
ENTRYPOINT /bin/drone-sonar

## sonar-scanner.properties

#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
sonar.java.binaries=/drone/src/target/classes

It's not a bug , the sonar-scanner require sonar.java.binaries when do the java code analysis but the default conf not supply it.

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

No branches or pull requests

3 participants