Sonar Qube code analysis failed with exist code 1 - sonarqube

I am using sonar qube for code analyzer but getting error as below:
Preparing `SonarQube` scanner...
`realpath`: '': No such file or directory
ERROR in /opt/resource/out : line 85 with exit code 1
and not getting specific reason why it is failing.

You are missing some input in your configuration, most likely something with maven (default settings.xml pointing to wrong repo). Default maven install folder for concourse-sonarqube-resource is /opt/apache-maven. By using the debug flag, whole trace (mvn -X) will be shown and you get your specific reason.
type: sonar-runner
source:
host_url: ((sonarqube.url))
__debug: true

Related

Sonarqube invalid value for java binaries

I'm trying to upload my project to a remote sonarqube server.
This is the command I run sonar scanner:
sonar-scanner -Dsonar.projectKey=my-project -Dsonar.host.url=https://xxxx:9000 -Dsonar.login=the-secret-key -Dsonar.java.binaries=**/target/classes
but it throws the error on java.binaries.
INFO: Configured Java source version (sonar.java.source):
none
INFO: JavaClasspath initialization
ERROR: Invalid value for sonar.java.binaries
INFO: ------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------
INFO: Total time: 20.276s
INFO: Final Memory: 10M/161M
INFO: ------------------------------------------------------
------------------
ERROR: Error during SonarQube Scanner execution
No files nor directories matching **/target/classes
I tried different values like ./target, /target/, /target/classes (where the jar is being stored). However, I am encountering this error of not found. (even though the directory exists)
By running sonar:sonar on my IDE and maven sonar:sonar on my terminal would send over the result to sonarqube, but my goal is to include this command in my jet-steps
Very old post but may help someone. I had similar issue and below configuration worked for me:
sonar.sources=src/main/java
sonar.java.binaries=target/classes
We also experienced a similar issue on our project (Maven multimodule), and for us the following configuration made things work:
sonar.java.binaries=.
sonar.java.source=8
sonar.sources=.
PS Java source is just for reference, it should not matter to fix the issue.
In my case, Im working with gradle, and we have subaplications, we are using sonarqube plugin from azure. I have to adapt to find binaries like this way:
sonar.java.binaries=./streamHubAndroidSDK/build/**,./nota/build/**,./app/build/**
But later I found that its better to define like this:
sonar.java.binaries=**/build/**
I can find this first building Android-Gradle project locally, and looking for all .class generated with bash:
find . -path '*/build/*.class' | xargs | tr ' ' ','

Unable to generate allure report in jenkins

getting the following error.
screenshot is also attached.
basically .bat is not getting generated.
ERROR: Step ‘Allure Report’ aborted due to exception:
java.io.IOException: Failed to rename C:\Users\dell\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure2\allure-2.4.1 to C:\Users\dell\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure2\allure-2.4.1.__rename
Now its working.
There is problem in allure command installation.
Maven central installer is giving error
Tried by giving link in jenkins global tool configuration and its working
Link : https://bintray.com/qameta/generic/download_file?file_path=io%2Fqameta%2Fallure%2Fallure%2F2.4.1%2Fallure-2.4.1.zip
I faced the same issue when configured with the latest version of Maven under Jenkins->Global Tool Configurations->Allure Commandline. Once i downgraded the Maven version I was able to generate allure reports successfully.
I had the same problem. In my case it was enough to delete allure-jenkins plugin from the list of plugins in Jenkins.

Running SonarQube scanner sonar-web-frontend IlligalStateException

I am running the SonarScanner using the sonar-web-frontend-plugin from the commandLine, it picks up the files and runs and I get an execution Failure
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Report processing did not complete successfully
: FAILED
My sonar-project.properties look like this
# must be unique in a given SonarQube instance
sonar.projectKey=Test.UI
# this is the name displayed in the SonarQube UI
sonar.projectName=Test.UI
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src/app
# exclude some files and folders (typically dependencies)
sonar.exclusions=bower_components/**/*, node_modules/**/*
# Encoding of the source files
sonar.sourceEncoding=UTF-8
You have the Build Breaker plugin installed on your SonarQube instance.
Your project failed its quality gate.
The Build Breaker plugin did its job, and "broke" (returned a non-success status code) your build.
Seems like it was because i had the default JS rules still installed and they can't exist side by side.

Jenkins/Maven build test failure

When I ran maven project from my terminal it works fine but when I ran the same test using Jenkins job it failed giving the following error :
Error Message
/build-nas/jenkins/jenkins163/workspace/Gitrepo/MAVEN/TestConfig.properties
(No such file or directory).
I see that the file is present in the workspace and I am using Git repo where I can see the file named TestConfig.properties present. Please advise. Thank you for the help.

Error during SonarQube Scanner execution

I'm running sonar-runner inside my project folder
I have put and configured the sonar-runner.properties in my project as well. But still the execution Sonar failed. Any idea as to what could be the problem ?
If project configuration file(sonar-project-properties) is being ignored then what is the workaround. Pl suggest asap.
This error is telling you that the Scanner is not finding your project properties. That is likely because the default name of the file is not sonar-runner.properties, nor sonar-project-properties, but sonar-project.properties.

Resources