简体   繁体   English

SonarQube生成PDF报告

[英]SonarQube generate PDF report

I have Jenkins to build my Java deployable and then push code into SonarQube for code scanning, 我让Jenkins构建可部署的Java,然后将代码推送到SonarQube中进行代码扫描,
I am able to see the Bug report on SonarQube as well, 我也可以在SonarQube上看到Bug报告,
But I want a downloadable report in a PDF format or anything that can be shared after the scan. 但是我想要PDF格式的可下载报告,或者扫描后可以共享的任何内容。

I added the following properties in my project's pom.xml- 我在项目的pom.xml-中添加了以下属性

<properties>
<sonar.analysis.mode>preview</sonar.analysis.mode>       <sonar.issuesReport.html.enable>true</sonar.issuesReport.html.enable>
</properties>

On my local Jenkins I have the following commands - 在我的本地Jenkins上,我有以下命令-

echo ** Executing SQ Analysis **
mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Demo -Dsonar.sources=src/main/java    -Dsonar.login=[someKey] -Dsonar.ProjectName=Demo -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true

I am getting the following error while trying to build - 尝试构建时出现以下错误-

[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Linear-ingestion ---
[INFO] Installing /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT.jar to /home/user/.m2/repository/com/cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.jar
[INFO] Installing /home/user/.jenkins/workspace/Linear/pom.xml to /home/user/.m2/repository/com/cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.pom
[INFO] Installing /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar to /home/user/.m2/repository/com/cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.531 s
[INFO] Finished at: 2018-07-04T13:41:08+05:30
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /home/user/.jenkins/workspace/Linear/pom.xml to com.cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.pom
[JENKINS] Archiving /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT.jar to com.cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.jar
[JENKINS] Archiving /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar to com.cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar
[Linear] $ /bin/sh -xe /home/user/office/R&D/apache-tomcat-8.5.31/temp/jenkins3011322823073246601.sh
channel stopped
+ echo RemoteSystemsTempFiles bin log4j.properties pom.xml src target Executing SQ Analysis RemoteSystemsTempFiles bin log4j.properties pom.xml src target
RemoteSystemsTempFiles bin log4j.properties pom.xml src target Executing SQ Analysis RemoteSystemsTempFiles bin log4j.properties pom.xml src target
+ mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Linear -Dsonar.sources=src/main/java -Dsonar.login=f51956611fa53b292bb19e25752cb22b5afe893e -Dsonar.ProjectName=Linear sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.cloudlytics:Linear-ingestion:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-core:jar -> version ${springframework.version} vs ${spring.version} @ line 52, column 15
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-context:jar -> version ${springframework.version} vs ${org.springframework-version} @ line 67, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] ------------------< com.cloudlytics:Linear-ingestion >------------------
[INFO] Building Linear-ingestion 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:3.4.1.1168:sonar (default-cli) @ Linear-ingestion ---
[INFO] User cache: /home/user/.sonar/cache
[INFO] SonarQube version: 6.7.4
[INFO] Default locale: "en_IN", source code encoding: "UTF-8"
[INFO] Issues mode
[WARNING] The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.
[INFO] Load global settings
[INFO] Load global settings (done) | time=454ms
[INFO] Server id: AWRKrQutLb-E1SWiQK4O
[INFO] User cache: /home/user/.sonar/cache
[INFO] Exclude plugins: devcockpit, ldap, authgithub, authbitbucket, pdfreport, authaad, googleanalytics, governance
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=141ms
[INFO] Scanning only changed files
[INFO] Process project properties
[INFO] Load project repositories
[WARNING] Project doesn't exist on the server. All issues will be marked as 'new'.
[INFO] Load project repositories (done) | time=72ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=2536ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1558ms
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=80ms
[INFO] Project key: Linear
[INFO] -------------  Scan Linear-ingestion
[INFO] Load server rules
[INFO] Load server rules (done) | time=804ms
[INFO] Base dir: /home/user/.jenkins/workspace/Linear
[INFO] Working dir: /home/user/.jenkins/workspace/Linear/target/sonar
[INFO] Source paths: src/main/java
[INFO] Source encoding: UTF-8, default locale: en_IN
[INFO] Index files
[INFO] 68 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 7
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=14ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=2ms
[INFO] Java Main Files AST scan
[INFO] 68 source files to be analyzed
[INFO] 45/68 files analyzed, current file: /home/user/.jenkins/workspace/Linear/src/main/java/com/blazeclan/sqs_polling_manager/xml/parser/dao/LogicallyDeleteDAO.java
[INFO] 68/68 source files have been analyzed
[INFO] Java Main Files AST scan (done) | time=12267ms
[INFO] Java Test Files AST scan
[INFO] 0 source files to be analyzed
[INFO] 0/0 source files have been analyzed
[INFO] Java Test Files AST scan (done) | time=3ms
[INFO] Sensor JavaSquidSensor [java] (done) | time=12972ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [/home/user/.jenkins/workspace/Linear/target/surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=3ms
[INFO] Sensor JaCoCoSensor [java]
[INFO] Sensor JaCoCoSensor [java] (done) | time=0ms
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
[INFO] Sensor Analyzer for "php.ini" files [php]
[INFO] Sensor Analyzer for "php.ini" files [php] (done) | time=11ms
[INFO] Performing issue tracking
[INFO] 79/79 components tracked
[INFO] ANALYSIS SUCCESSFUL
[INFO] Task total time: 22.039 s
[INFO] 
[INFO] ------------------< com.cloudlytics:Linear-ingestion >------------------
[INFO] Building Linear-ingestion 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.370 s
[INFO] Finished at: 2018-07-04T13:41:51+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "sonar-runner". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
Build step 'Execute shell' marked build as failure
Finished: FAILURE

You want to execute unexistent sonar-runner goal: 您要执行不存在的sonar-runner目标:

mvn sonar:sonar -Dsonar.host.url= http://localhost:9000 -Dsonar.projectKey=Demo -Dsonar.sources=src/main/java -Dsonar.login=[someKey] -Dsonar.ProjectName=Demo sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true mvn声纳:声纳-Dsonar.host.url = http:// localhost:9000 -Dsonar.projectKey = Demo -Dsonar.sources = src / main / java -Dsonar.login = [someKey] -Dsonar.ProjectName = Demo 声纳-跑步者 -Dsonar.analysis.mode =预览-Dsonar.issuesReport.html.enable = true

You have to remove it: 您必须删除它:

mvn sonar:sonar -Dsonar.host.url= http://localhost:9000 -Dsonar.projectKey=Demo -Dsonar.sources=src/main/java -Dsonar.login=[someKey] -Dsonar.ProjectName=Demo -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true mvn声纳:声纳-Dsonar.host.url = http:// localhost:9000 -Dsonar.projectKey = Demo -Dsonar.sources = src / main / java -Dsonar.login = [someKey] -Dsonar.ProjectName = Demo -Dsonar .analysis.mode =预览-Dsonar.issuesReport.html.enable = true

I would recommended to remove more parameters: 我建议删除更多参数:

  • sonar.projectKey - maven plugin is responsible for generating this parameter sonar.projectKey -maven插件负责生成此参数
  • sonar.ProjectName - doesn't exist (correct name is sonar.projectName ), maven plugin will use vaule of name or artifactId nodes from your pom.xml file sonar.ProjectName不存在(正确的名称是sonar.projectName ),maven插件将使用pom.xml文件中的sonar.projectName of nameartifactId节点
  • sonar.sources=src/main/java - maven plugin is responsible for generating value of this parameter sonar.sources=src/main/java -maven插件负责生成此参数的值
  • sonar.analysis.mode=preview - deprecated and shouldn't be used (since 6.6, you use 6.7.4) sonar.analysis.mode=preview已弃用,不应使用(从6.6开始,请使用6.7.4)
  • sonar.issuesReport.html.enable - Issues Report Plugin which uses this parameter is incompatible with SonarQube 6.7.4 sonar.issuesReport.html.enable使用此参数的问题报告插件与SonarQube 6.7.4不兼容

Finally you can execute a simple and short command: 最后,您可以执行一个简单而简短的命令:

mvn sonar:sonar -Dsonar.host.url= http://localhost:9000 -Dsonar.login=[someKey] mvn声纳:声纳-Dsonar.host.url = http:// localhost:9000 -Dsonar.login = [someKey]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM