java.lang.IllegalStateException for sonarqube scanning for .Net solution - jenkins

I am running Sonar-Scanner through Jenkins and unable to get the analysis successful for .Net solution. Below is the attached screenshot of the error.
enter image description here
The error shows that
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Line 295 is out of range in the file (...) (lines: 294)
But there are only 294 lines in this file.
I am using below versions:
sonar-scanner-msbuild-3.0.2.656
sonarqube-6.6

I had the same issue with bamboo and dotnet-core.
It occured with a file that went down on number of lines.
The problem seemed to be that sonar was using the cache, thats why it looked for a line out of range.
The solution in my case was,in bamboo jargon, to force a clean build, or in jenkins jargon, execute on a clean workspace .

Related

Sonarqube build for UWP-App failed

I habe a TFS-Server-Build (TFS 2017) on a Build-Agent with VS 2017. The first Buildstep (Prepare the Sonarqube analysis) and the build of the solution works fine. But i have a error at "Complete the SonarQube analysis":
2017-05-29T03:06:09.1933915Z ##[error]The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
2017-05-29T03:06:09.1933915Z ##[error]Possible causes:
2017-05-29T03:06:09.1933915Z ##[error]1. The project has not been built - the project must be built in between the begin and end steps
2017-05-29T03:06:09.1933915Z ##[error]2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
2017-05-29T03:06:09.1933915Z ##[error]3. The begin, build or end steps have not all been launched from the same folder
2017-05-29T03:06:09.1933915Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2017-05-29T03:06:09.1933915Z ##[error]05:06:09.115 Post-processing failed. Exit code: 1
Can anyone help?
Kind regards
Sebastian
I am not familiar with TFS-Server-Build,, but the possible causes are mentioned.
Check the following link for more details on how to set it up properly
Just like the error mentioned this stands for SonarQube was unable to collect the required information about your projects
Even though you have installed MSBUILD 12 or above, you should make sure the Build agent is calling the right version.
And double check if the MSBuild.SonarQube.Runner and MSBuild is running from the same working directory. At .sonarqube/out folder the sonar-project.properties is getting created or not.

Getting an error while integrating SonarQube with Jenkins

I followed the SonarQube Jenkins integration tutorial from SonarQube official website. I am getting an error after building my project.
[RetailerWebsite_releaseTestCodeDx] $ "C:\Program Files (x86)\Jenkins2\tools\hudson.plugins.sonar.SonarRunnerInstallation\My_scanner\bin\sonar-scanner.bat" "SonarQube Scanner" -e -Dsonar.host.url=http://10.252.80.55:9000 -Dsonar.projectName=RetailerWebsite -Dsonar.projectVersion=1.0 -Dsonar.projectKey=Retailer-Website -Dsonar.sources=. -Dsonar.projectBaseDir=D:\Builds\RetailerWebsite_releaseTestCodeDx
\Jenkins2\tools\hudson.plugins.sonar.SonarRunnerInstallation\My_scanner\bin\..\jre was unexpected at this time.
ERROR: SonarQube scanner exited with non-zero code: 255
Project Configuration
Global Configuration
It appears you are victim of this Jenkins bug: when using a JRE installed at a path that includes parentheses, Jenkins (on Windows) tries to execute an invalid command.
Workaround: install the JDK elsewhere, and use that one in your Job configuration (or Jenkins itself).

error : Web deployment task failed. (Unknown ProviderOption:DefiningProjectFullPath)

All the solutions provided in stack for below error didn't help me. I am using /p:VisualStudioVersion=10.0 /p:Configuration=Release
/p:DesktopBuildPackageLocation=$WORKSPACE\package.zip /t:Package has Command Line Arguments under Jenkins job to run MSBuild proj. "package.zip" file is not getting created under my work-space if I use /p:DesktopBuildPackageLocation=some\package.zip Please suggest me command Line arguments. I am using Upload artifact to Nexus plugin as well to upload this zip file.
error : Web deployment task failed. (Unknown ProviderOption:DefiningProjectFullPath. Known ProviderOptions are:.)

NullPointerException in Jenkins

I'm currently reading the book 'Jenkins Continuous Integration Cookbook', and I came across this error after building a project on Jenkins:
ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users#googlegroups.com
java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:58)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
at hudson.FilePath.act(FilePath.java:1001)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:604)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
project=hudson.maven.MavenModuleSet#68f55ff2[A]
project.getModules()=[]
project.getRootModule()=null
I'm confused why I'm getting this, since my Java code is all autogenerated via Maven, and my tests in HTML format. I was able to successfully build the code using maven, before placing a directory with /src and pom.xml as it's children onto bitbucket.
Any ideas why this error is showing? Any advice will be appreciated.
Adding the rest of the error logs below (couldn't before because I was getting formatting errors).
FATAL: null
java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:58)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
at hudson.FilePath.act(FilePath.java:1001)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:604)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
According a similar bug report (but not exactly the same) I guess that your problem may be caused by a wrong configuration in Jenkins.
I suggest you to check the MAVEN_HOME used by Jenkins (i.e. check that it is really a MAVEN_HOME directory and is the correct maven version)

Maven plugin failed after upgrading Jenkins to 1.505

I have upgraded my Jenkins server to 1.505 but unexpectedly building with Maven plugin is not working and it throws an exception in the Jenkins logs
Error injecting constructor, java.lang.NoClassDefFoundError: hudson/ivy/AntIvyBuildWrapper
and after an hour googling this issue I found that Maven plugin guys upgrade their code base and it failed on an "optional" dependency, so I added the "optional plugin" but still it fails silently without any exception in the Jenkins logs.
the error appears on the console log is ERROR: Couldn't find Maven executable.
any hints ?!
The new maven plugin adds a new option to the Jobs I have (under the build section -> Invoke Maven 3 there is a new field called Maven version).
So what we need to do is open each job configuration page and hit the save button in order to save the default value and it will solve the problem.

Resources