JetBrains / TeamCity.SonarQubePlugin

A plugin for TeamCity server allowing you to configure and run SonarQube analysis from the CI
Apache License 2.0
53 stars 31 forks source link

Failed to run sonar #42

Closed TKul6 closed 6 years ago

TKul6 commented 6 years ago

Hi, I'm using teamcity 2017.1.5 with Sonar server 5.6.7 when I use the plug in I get the following error message: [10:30:11] ERROR: Error during Sonar runner execution [10:30:11] org.sonar.runner.impl.RunnerException: Unable to execute Sonar [10:30:11] at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) [10:30:11] at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [10:30:11] at java.security.AccessController.doPrivileged(Native Method) [10:30:11] at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [10:30:11] at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [10:30:11] at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [10:30:11] at org.sonar.runner.api.Runner.execute(Runner.java:100) [10:30:11] at org.sonar.runner.Main.executeTask(Main.java:70) [10:30:11] at org.sonar.runner.Main.execute(Main.java:59) [10:30:11] at org.sonar.runner.Main.main(Main.java:53) [10:30:11] Caused by: Not authorized. Please check the properties sonar.login and sonar.password. [10:30:11] ERROR: [10:30:11] ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging. [10:30:11] Process exited with code 1

I double checked the login information I provided in the plug in configuration and it is valid.

Do you have any suggestions how to solve this problem?

Thanks

Linfar commented 6 years ago

Hello

What plugin version do you use? Check the account you are using has permissions to send data to the SonarQube Server. If it does - try recreating the SonarQube Server profile in the TeamCity.

TKul6 commented 6 years ago

I'm using version 2017.1-10.

I checked again the permissions in the Sonar side, it seems Ok, the Execute Analysis is open for every user.

Do you have any other suggestions?

Linfar commented 6 years ago

Did you try to create new server profile (not modifying existing one)? I've found an issue with editing profile - password is not updated when using tab to navigate to the password field (mouse click works normally).

TKul6 commented 6 years ago

Ok that seems to do it, However know the build pass but I get the following exception from the plug in: [Step 4/4] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [15:43:03] [Step 4/4] at SonarSource.TfsAnnotate.Program.Main(String[] args)

Is it O.K. (because the build passes ... so there is something strange here).

Thanks a lot, TMaster

Linfar commented 6 years ago

Thanks for update. The issue I've mentioned is already fixed and build is complete so I'll add the tag to it

Linfar commented 6 years ago

Do you need help with exception you've got?

TKul6 commented 6 years ago

Hi, I need to understand why it happens, now it seems that nothing coming to sonar, I fear this is because of the exception. By the way I have another project which is in git (hosted by TFS) and it works fine.

And in the log file it says: **103 files to be analyzed so I think there should be data sent to the sonar server.

Do you have any suggestions?

Linfar commented 6 years ago

It seems SonarQube Scanner uses some TFS libraries which cannot be finded in runtime (to annotate the commit I suppose). I found this discussion which seems to be related: https://groups.google.com/forum/#!topic/sonarqube/msJvFA_KYt0

TKul6 commented 6 years ago

Hi, so I did when the article said, and then I got the following error (for each file of my project).

17:07:05.986 ERROR - Unable to TFS annotate the following file which is not in a mapped TFS

Again the plug in does not analyze any file.

Do you have any suggestions?

Linfar commented 6 years ago

Unfortunately I'm not in common with TFS and its integration in SonarQube. Googling shows following article: https://stackoverflow.com/questions/43177756/unable-to-tfs-annotate-the-following-file-which-is-not-in-a-mapped-tfs-workspace

You can check the TeamCity plugin is working correctly by disabling TFS plugin in SonarQube Server

wolfasaeru commented 6 years ago

Hi,

I'm getting the same error when TeamCity requests for submit to the SonarQube API. I think it could be incompatibility issues between versions.

Here's my platform versions:

And the error log (also with the -X flag):

[12:44:47] : [Step 2/2] 08:44:47.797 DEBUG - POST 400 http://********:9000/api/ce/submit?projectKey=AndroidSmarterDevice&projectName=Android%20|%20Smarter%20Device | time=249ms [12:44:47] : [Step 2/2] INFO: ------------------------------------------------------------------------ [12:44:47] : [Step 2/2] INFO: EXECUTION FAILURE [12:44:47] : [Step 2/2] INFO: ------------------------------------------------------------------------ [12:44:47] : [Step 2/2] Total time: 8:11.554s [12:44:48] : [Step 2/2] Final Memory: 38M/276M [12:44:48] : [Step 2/2] INFO: ------------------------------------------------------------------------ [12:44:48]W: [Step 2/2] ERROR: Error during Sonar runner execution [12:44:48]W: [Step 2/2] org.*******.runner.impl.RunnerException: Unable to execute Sonar [12:44:48]W: [Step 2/2] at org.*******.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) [12:44:48]W: [Step 2/2] at org.*******.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [12:44:48]W: [Step 2/2] at java.security.AccessController.doPrivileged(Native Method) [12:44:48]W: [Step 2/2] at org.*******.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [12:44:48]W: [Step 2/2] at org.*******.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [12:44:48]W: [Step 2/2] at org.*******.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [12:44:48]W: [Step 2/2] at org.*******.runner.api.Runner.execute(Runner.java:100) [12:44:48]W: [Step 2/2] at org.*******.runner.Main.executeTask(Main.java:70) [12:44:48]W: [Step 2/2] at org.*******.runner.Main.execute(Main.java:59) [12:44:48]W: [Step 2/2] at org.*******.runner.Main.main(Main.java:53) [12:44:48]W: [Step 2/2] Caused by: [12:44:48]W: [Step 2/2] Process exited with code 1 [12:44:49]E: [Step 2/2] Process exited with code 1 [12:44:49]E: [Step 2/2] Step SonarQube Runner failed

Linfar commented 6 years ago

@wolfasaeru In the latest plugin version you can use new SonarQube Scanner version

wolfasaeru commented 6 years ago

Thanks for your response. Yes, actually the SonarQube people told me the same. I changed it to the 3.0.3 version and the same happens, for now I plan to do the SonarQube step from fastlane

levindv commented 6 years ago

Hey! I'm using TC 2017.2.1 and plugin for TC 2017.1.* (latest for now) and sonar 6.7 and still having issue with TAB button. Mouse click is OK :)

Linfar commented 6 years ago

@levindv Should be fixed now, sorry for long response