Sonar Maven 3 Bamboo Task run failed
Asked by Craig Change:

```
SonarQube 8.3 Community Version with Community Branch Plugins
Bitbucket version: 6.7
Bamboo version: 6.10

The configuration may be wrong with somewhere. Anyone could help me?

Log?
------------

simple	28-????-2020 01:06:07	Build Pluto - Pluto Plan - feature-BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format - Maven Build Job #4 (PLUT-PP3-JOB1-4) started building on agent Default Agentsimple	28-????-2020 01:06:07	simple	28-????-2020 01:06:07	Build working directory is C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1simple	28-????-2020 01:06:07	Executing build Pluto - Pluto Plan - feature-BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format - Maven Build Job #4 (PLUT-PP3-JOB1-4)simple	28-????-2020 01:06:07	Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'simple	28-????-2020 01:06:07	Checking out into C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1simple	28-????-2020 01:06:07	Checking out code from PLUT-PP, revision 02ea3441c53fda495bd84e753dab233522871b23simple	28-????-2020 01:06:07	and merging code from PLUT-PP3-JOB1, revision d9ff3dd91a5501f53c806efa04a87f4d4c49d3easimple	28-????-2020 01:06:07	Fetching 'refs/heads/master' from 'ssh://git@localhost:7999/pp/pluto.git'.simple	28-????-2020 01:06:07	Warning: Permanently added '[127.0.0.1]:51441' (RSA) to the list of known hosts.simple	28-????-2020 01:06:08	Checking out revision 02ea3441c53fda495bd84e753dab233522871b23.simple	28-????-2020 01:06:08	Already on 'master'simple	28-????-2020 01:06:08	Your branch is up to date with 'origin/master'.simple	28-????-2020 01:06:08	Fetching 'refs/heads/feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format' from 'ssh://git@localhost:7999/pp/pluto.git'.simple	28-????-2020 01:06:08	Warning: Permanently added '[127.0.0.1]:51441' (RSA) to the list of known hosts.simple	28-????-2020 01:06:09	Already up to date.simple	28-????-2020 01:06:09	No new changes on PLUT-PP3-JOB1 found to merge.simple	28-????-2020 01:06:09	Updated source code to revision: 02ea3441c53fda495bd84e753dab233522871b23simple	28-????-2020 01:06:09	Finished task 'Checkout Default Repository' with result: Successsimple	28-????-2020 01:06:09	Running pre-build action: VCS Version Collectorsimple	28-????-2020 01:06:09	Starting task 'Sonar Maven 3' of type 'ch.mibex.bamboo.sonar4bamboo:sonar4bamboo.maven3task'simple	28-????-2020 01:06:09	SONAR4BAMBOO: Will use feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format as sonar.branch.name.simple	28-????-2020 01:06:09	SONAR4BAMBOO: No branch target found, will not configure sonar.branch.target.command	28-????-2020 01:06:09	Beginning to execute external process for build 'Pluto - Pluto Plan - feature-BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format - Maven Build Job #4 (PLUT-PP3-JOB1-4)'\n ... running command line: \nD:\Software\Atlassian\Bamboo\tools\apache-maven-3.5.0\bin\mvn.cmd sonar:sonar -Dsonar.branch.name=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format -Dsonar.host.url=http://localhost:9000 -Dsonar.login=****** -Dsonar.password=****** -Dsonar.report.export.path=.\n ... in: C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1\bmicalculator\n ... using extra environment variables: \nbamboo_planRepository_1_branch=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_repository_3440642_previous_revision_number=4a2eddf4713992d6a2722077e6f5c7c9ce96955e\nbamboo_planRepository_1_branchDisplayName=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_repository_revision_number=02ea3441c53fda495bd84e753dab233522871b23\nMAVEN2_HOME=D:\Software\Atlassian\Bamboo\tools\apache-maven-3.5.0\nbamboo_resultsUrl=http://localhost:8085/browse/PLUT-PP3-JOB1-4\nbamboo_capability_system_jdk_JDK11=C:\Program Files\Java\jdk-11.0.7\\nbamboo_capability_system_builder_msbuild_MSBuild_v4_0__32bit_=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe\nbamboo_repository_6979586_git_username=\nbamboo_build_working_directory=C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1\nbamboo_planRepository_1_name=Pluto Repository\nbamboo_buildKey=PLUT-PP3-JOB1\nbamboo_repository_6979586_git_branch=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_SonarQubePassword=********\nbamboo_shortPlanName=Pluto Plan\nbamboo_repository_6979586_name=Pluto Repository\nbamboo_planRepository_integrationBranch_revision=02ea3441c53fda495bd84e753dab233522871b23\nbamboo_planRepository_name=Pluto Repository\nbamboo_buildNumber=4\nbamboo_shortJobName=Maven Build Job\nbamboo_buildResultsUrl=http://localhost:8085/browse/PLUT-PP3-JOB1-4\nbamboo_planRepository_repositoryUrl=ssh://git@localhost:7999/pp/pluto.git\nbamboo_ManualBuildTriggerReason_stageName=Build Stage\nbamboo_agentId=360449\nbamboo_planName=Pluto - Pluto Plan - feature-BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_repository_3440642_name=Pluto Repository\nbamboo_shortPlanKey=PP3\nbamboo_planRepository_integrationBranch_branch=master\nbamboo_shortJobKey=JOB1\nbamboo_planRepository_revision=d9ff3dd91a5501f53c806efa04a87f4d4c49d3ea\nbamboo_buildTimeStamp=2020-05-28T01:06:07.706+08:00\nbamboo_repository_previous_revision_number=d9ff3dd91a5501f53c806efa04a87f4d4c49d3ea\nbamboo_planRepository_integrationBranch_name=Pluto Repository\nbamboo_capability_system_builder_mvn3_Maven_Build_3_0=D:\Software\Atlassian\Bamboo\tools\apache-maven-3.5.0\nM2_HOME=D:\Software\Atlassian\Bamboo\tools\apache-maven-3.5.0\nbamboo_repository_6979586_branch_name=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_repository_git_branch=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_buildResultKey=PLUT-PP3-JOB1-4\nbamboo_repository_branch_name=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_buildPlanName=Pluto - Pluto Plan - feature-BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format - Maven Build Job\nbamboo_planRepository_1_revision=d9ff3dd91a5501f53c806efa04a87f4d4c49d3ea\nbamboo_repository_6979586_revision_number=02ea3441c53fda495bd84e753dab233522871b23\nbamboo_repository_3440642_branch_name=master\nbamboo_repository_3440642_revision_number=02ea3441c53fda495bd84e753dab233522871b23\nbamboo_repository_name=Pluto Repository\nbamboo_planRepository_integrationBranch_username=\nJAVA_HOME=C:\Program Files\Java\jdk1.8.0_201\\nbamboo_dependenciesDisabled=false\nbamboo_buildFailed=false\nbamboo_repository_3440642_git_branch=master\nbamboo_repository_6979586_git_repositoryUrl=ssh://git@localhost:7999/pp/pluto.git\nbamboo_planRepository_branch=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_agentWorkingDirectory=C:\AppData\bamboo-home\xml-data\build-dir\nbamboo_capability_system_git_executable=D:\Software\Git\cmd\git.exe\nbamboo_repository_git_username=\nbamboo_planRepository_branchDisplayName=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_planRepository_integrationBranch_repositoryUrl=ssh://git@localhost:7999/pp/pluto.git\nbamboo_repository_6979586_previous_revision_number=d9ff3dd91a5501f53c806efa04a87f4d4c49d3ea\nbamboo_planRepository_1_type=bbserver\nbamboo_planRepository_branchName=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nbamboo_repository_3440642_git_username=\nbamboo_plan_storageTag=plan-6848514\nbamboo_hg_cache_directory=C:\AppData\bamboo-home\xml-data\build-dir\_hg-repositories-cache\nbamboo_planRepository_1_username=\nbamboo_planRepository_type=bbserver\nbamboo_git_cache_directory=C:\AppData\bamboo-home\xml-data\build-dir\_git-repositories-cache\nbamboo_ManualBuildTriggerReason_userName=yangyong\nbamboo_planRepository_integrationBranch_type=bbserver\nbamboo_repository_git_repositoryUrl=ssh://git@localhost:7999/pp/pluto.git\nbamboo_capability_system_builder_msbuild_MSBuild_v4_0__64bit_=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe\nbamboo_repository_3440642_git_repositoryUrl=ssh://git@localhost:7999/pp/pluto.git\nbamboo_planRepository_integrationBranch_branchName=master\nbamboo_tmp_directory=C:\AppData\bamboo-home\temp\nbamboo_working_directory=C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1\nbamboo_planKey=PLUT-PP3\nbamboo_RerunBuildTriggerReason_noOfRetries=2\nbamboo_planRepository_1_repositoryUrl=ssh://git@localhost:7999/pp/pluto.git\nbamboo_planRepository_username=\nbamboo_capability_system_jdk_JDK_1_8=C:\Program Files\Java\jdk1.8.0_201\\nbamboo_capability_system_jdk_JDK_1_8_0_201=C:\Program Files\Java\jdk1.8.0_201\\nbamboo_planRepository_integrationBranch_branchDisplayName=master\nbamboo_planRepository_1_branchName=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format\nPath=C:\Program Files\Java\jdk1.8.0_201\\bin;D:\Software\XFTP6\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Java\jdk1.8.0_201\\bin;D:\Software\Git\cmd;D:\Software\OpenVPN\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Software\PuTTY\;C:\Users\craig\AppData\Local\Microsoft\WindowsApps;C:\Users\craig\.dotnet\tools\nbuild	28-????-2020 01:06:11	[INFO] Scanning for projects...build	28-????-2020 01:06:11	[WARNING] build	28-????-2020 01:06:11	[WARNING] Some problems were encountered while building the effective model for insigma.com:bmicalculator:jar:0.0.1-SNAPSHOTbuild	28-????-2020 01:06:11	[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: junit:junit:jar -> duplicate declaration of version (?) @ line 61, column 15build	28-????-2020 01:06:11	[WARNING] build	28-????-2020 01:06:11	[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.build	28-????-2020 01:06:11	[WARNING] build	28-????-2020 01:06:11	[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.build	28-????-2020 01:06:11	[WARNING] build	28-????-2020 01:06:12	[INFO] build	28-????-2020 01:06:12	[INFO] ------------------------------------------------------------------------build	28-????-2020 01:06:12	[INFO] Building bmicalculator 0.0.1-SNAPSHOTbuild	28-????-2020 01:06:12	[INFO] ------------------------------------------------------------------------build	28-????-2020 01:06:13	[INFO] build	28-????-2020 01:06:13	[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ bmicalculator ---build	28-????-2020 01:06:15	[INFO] User cache: C:\Windows\system32\config\systemprofile\.sonar\cachebuild	28-????-2020 01:06:15	[INFO] SonarQube version: 8.3.1build	28-????-2020 01:06:15	[INFO] Default locale: "zh_CN", source code encoding: "UTF-8"build	28-????-2020 01:06:16	[WARNING] SonarScanner will require Java 11 to run starting in SonarQube 8.xbuild	28-????-2020 01:06:16	[INFO] Load global settingsbuild	28-????-2020 01:06:16	[INFO] Load global settings (done) | time=513msbuild	28-????-2020 01:06:16	[INFO] Server id: BF41A1F2-AXI4L2sDjPWasQwcay9jbuild	28-????-2020 01:06:16	[INFO] User cache: C:\Windows\system32\config\systemprofile\.sonar\cachebuild	28-????-2020 01:06:16	[INFO] Load/download pluginsbuild	28-????-2020 01:06:16	[INFO] Load plugins indexbuild	28-????-2020 01:06:17	[INFO] Load plugins index (done) | time=447msbuild	28-????-2020 01:06:17	[INFO] Load/download plugins (done) | time=515msbuild	28-????-2020 01:06:18	[INFO] Process project propertiesbuild	28-????-2020 01:06:18	[INFO] Process project properties (done) | time=16msbuild	28-????-2020 01:06:18	[INFO] Execute project buildersbuild	28-????-2020 01:06:18	[INFO] Execute project builders (done) | time=4msbuild	28-????-2020 01:06:18	[INFO] Project key: insigma.com:bmicalculatorbuild	28-????-2020 01:06:18	[INFO] Base dir: C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1\bmicalculatorbuild	28-????-2020 01:06:18	[INFO] Working dir: C:\AppData\bamboo-home\xml-data\build-dir\PLUT-PP3-JOB1\bmicalculator\target\sonarbuild	28-????-2020 01:06:18	[INFO] Load project settings for component key: 'insigma.com:bmicalculator'build	28-????-2020 01:06:18	[INFO] Load project settings for component key: 'insigma.com:bmicalculator' (done) | time=418msbuild	28-????-2020 01:06:18	[INFO] Load project branchesbuild	28-????-2020 01:06:19	[INFO] Load project branches (done) | time=396msbuild	28-????-2020 01:06:19	[INFO] Load project pull requestsbuild	28-????-2020 01:06:19	[INFO] Load project pull requests (done) | time=377msbuild	28-????-2020 01:06:19	[INFO] Load branch configurationbuild	28-????-2020 01:06:19	[INFO] ------------------------------------------------------------------------build	28-????-2020 01:06:19	[INFO] BUILD FAILUREbuild	28-????-2020 01:06:19	[INFO] ------------------------------------------------------------------------build	28-????-2020 01:06:19	[INFO] Total time: 8.503 sbuild	28-????-2020 01:06:19	[INFO] Finished at: 2020-05-28T01:06:19+08:00build	28-????-2020 01:06:19	[INFO] Final Memory: 38M/350Mbuild	28-????-2020 01:06:19	[INFO] ------------------------------------------------------------------------build	28-????-2020 01:06:19	[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project bmicalculator: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration: SHORT -> [Help 1]build	28-????-2020 01:06:19	[ERROR] build	28-????-2020 01:06:19	[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.build	28-????-2020 01:06:19	[ERROR] Re-run Maven using the -X switch to enable full debug logging.build	28-????-2020 01:06:19	[ERROR] build	28-????-2020 01:06:19	[ERROR] For more information about the errors and possible solutions, please read the following articles:build	28-????-2020 01:06:19	[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionExceptionsimple	28-????-2020 01:06:20	Failing task since return code of [D:\Software\Atlassian\Bamboo\tools\apache-maven-3.5.0\bin\mvn.cmd sonar:sonar -Dsonar.branch.name=feature/BUDDHA-13-bmi-calculator-should-support-the-return-value-of-json-format -Dsonar.host.url=http://localhost:9000 -Dsonar.login=****** -Dsonar.password=****** -Dsonar.report.export.path=.] was 1 while expected 0simple	28-????-2020 01:06:20	SONAR4BAMBOO: was not able to find a SonarQube result URLsimple	28-????-2020 01:06:20	Finished task 'Sonar Maven 3' with result: Errorsimple	28-????-2020 01:06:20	Running post build plugin 'NCover Results Collector'simple	28-????-2020 01:06:20	Running post build plugin 'Artifact Copier'simple	28-????-2020 01:06:20	Publishing an artifact: Pluto Artifactsimple	28-????-2020 01:06:20	Finished publishing of artifact Required shared artifact: [Pluto Artifact], pattern: [**/*.jar] anchored at: [bmicalculator/target] in 148.8 mssimple	28-????-2020 01:06:20	Running post build plugin 'npm Cache Cleanup'simple	28-????-2020 01:06:20	Running post build plugin 'Clover Results Collector'simple	28-????-2020 01:06:20	Running post build plugin 'Docker Container Cleanup'simple	28-????-2020 01:06:20	Finalising the build...simple	28-????-2020 01:06:20	Stopping timer.simple	28-????-2020 01:06:20	Build PLUT-PP3-JOB1-4 completed.simple	28-????-2020 01:06:20	Running on server: post build plugin 'NCover Results Collector'simple	28-????-2020 01:06:20	Running on server: post build plugin 'Build Hanging Detection Configuration'simple	28-????-2020 01:06:20	Running on server: post build plugin 'Bamboo project link creator'simple	28-????-2020 01:06:20	Running on server: post build plugin 'Clover Delta Calculator'simple	28-????-2020 01:06:20	Running on server: post build plugin 'Maven Dependencies Postprocessor'simple	28-????-2020 01:06:20	All post build plugins have finishedsimple	28-????-2020 01:06:20	Generating build results summary...simple	28-????-2020 01:06:20	Saving build results to disk...simple	28-????-2020 01:06:20	Logging substituted variables...simple	28-????-2020 01:06:20	Indexing build results...simple	28-????-2020 01:06:20	Finished building PLUT-PP3-JOB1-4.
```


Answers:
author: Craig Change
body: My resolution is as follows:

In the task of Sonar Maven 3 of Bamboo CI, configure "Replacement for illegal branch characters" as "-". This config is for replace the / in the branch name like "feature/xxxx" to "feature-xxxx". (You could see the screenshot for Sonarqube project name.)

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/97087iE6FCA3037A47D169/image-size/large?v=v2&px=999 "image.png")

-----------------

Sonar only allows alphanumeric, "-", "_" and "." characters in its project keys. Therefore, a "/" which is typically used in Git branch naming patterns (e.g., features/user-story-xyz) must be replaced by the provided character here. The default "_" is fine when you use Sonar for Bitbucket Server or Jenkins.


author: Andy Heinzer
body: Hi,

I understand you have found a resolution to this question. Please post your solution here as an answer to the question (not as a reply to my answer). This way you can then accept your own answer. This can serve to help other users that might encounter the same problem again in the future.

Thanks

Andy

comments: author: Craig Change
body: Thanks for your reminder, Andy!