# On Windows, execute: C:\sonarqube\bin\windows-x86-64\StartSonar.bat
# On other operating systems, as a non-root user execute: # 启动 su - sonarqube -c "/app/sonarqube/bin/linux-x86-64/sonar.sh console"
# 查看启动状态 su sonar ./bin/linux-x86-64/sonar.sh status
# 跟踪日志 su sonar tail -f /usr/local/sonarqube-6.7.5/logs/sonar.log
# 如出现以下四行表示启动成功 jvm 1 | 2020.12.30 09:39:42 INFO app[][o.s.a.SchedulerImpl] Process[es] is up jvm 1 | 2020.12.30 09:39:55 INFO app[][o.s.a.SchedulerImpl] Process[web] is up jvm 1 | 2020.12.30 09:39:59 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up jvm 1 | 2020.12.30 09:39:59 INFO app[][o.s.a.SchedulerImpl] SonarQube is up
# 例如,在Linux操作系统下,可以在主机上以root用户运行以下命令来设置当前会话的推荐值: # For example, on Linux, you can set the recommended values for the current session by running the following commands as root on the host: sysctl -w vm.max_map_count=262144 sysctl -w fs.file-max=65536 ulimit -n 65536 ulimit -u 4096
Step 4.执行部署sonarqube并查看部署状态
1 2 3 4 5 6 7 8 9
~/k8s/sonarqube$ kubectl create -f sonarqube-deployment.yaml -n devops # deployment.apps/sonarqube created # persistentvolumeclaim/sonarqube-data created # service/sonarqube created
# 项目扫描 sonar-scanner -Dsonar.projectname=Hello-World-Blog -Dsonar.projectKey=Hello-World -Dsonar.sources=. # INFO: CPD Executor CPD calculation finished (done) | time=270833ms # INFO: Analysis report generated in 10280ms, dir size=159 MB # INFO: Analysis report compressed in 44023ms, zip size=39 MB # INFO: Analysis report uploaded in 1574ms # INFO: ANALYSIS SUCCESSFUL, you can browse http://sonarqube.weiyigeek.top/dashboard?id=html # INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report # INFO: More about the report processing at http://sonarqube.weiyigeek.top/api/ce/task?id=AXa2xmjzr2pPEzGrpOUX # INFO: Analysis total time: 6:52.709 s # INFO: ------------------------------------------------------------------------ # INFO: EXECUTION SUCCESS # 分析扫描完成 # INFO: ------------------------------------------------------------------------ # INFO: Total time: 6:54.148s # INFO: Final Memory: 16M/423M # INFO: ------------------------------------------------------------------------
# 方式1 mvn sonar:sonar -Dsonar.host.url=http://sonar.weiyigeek.top:9000 -Dsonar.login=1b0b037f06e7990c360d62ce9151aaf978cec155 # [INFO] Scanning for projects... # Downloading from weiyigeek-maven: http://maven.weiyigeek.top:8081/repository/maven-public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom # .... # [INFO] ANALYSIS SUCCESSFUL, you can browse http://sonarqube.weiyigeek.top/dashboard?id=com.weiyigeek.main%3Ahello-world # [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report # [INFO] More about the report processing at http://sonarqube.weiyigeek.top/api/ce/task?id=AXa2595Cr2pPEzGrpOUp # [INFO] Analysis total time: 7.113 s # [INFO] ------------------------------------------------------------------------ # [INFO] BUILD SUCCESS # [INFO] ------------------------------------------------------------------------ # [INFO] Total time: 27.219 s # [INFO] Finished at: 2020-12-31T03:46:57Z # [INFO] ------------------------------------------------------------------------
# 方式2.在 Maven 配置文件 文件中定义Token后 mvn sonar:sonar
# 方式3.采用 `Sonar-scanner` 方式进行扫描该Maven项目 sonar-scanner -Dsonar.projectName=Java-maven -Dsonar.projectKey=Hello-World -Dsonar.sources=. -Dsonar.java.binaries=target/ # INFO: ANALYSIS SUCCESSFUL, you can browse http://sonarqube.weiyigeek.top/dashboard?id=Hello-World # INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report # INFO: More about the report processing at http://sonarqube.weiyigeek.top/api/ce/task?id=AXa3PxQNr2pPEzGrpOU1 # INFO: Analysis total time: 3.467 s # INFO: ------------------------------------------------------------------------ # INFO: EXECUTION SUCCESS # INFO: ------------------------------------------------------------------------ # INFO: Total time: 4.293s # INFO: Final Memory: 18M/163M # INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution java.lang.IllegalStateException: Can not execute Findbugs at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:188) at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:114) at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85) at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59) at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138) at org.sonarsource.scanner.cli.Main.execute(Main.java:112) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by: java.lang.IllegalStateException: One (sub)project contains Java source files that are not compiled (/home/jenkins/agent/workspace/info_manage_rebuild). at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:123) at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119) ... 31 more ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!