I'm seeing the following errors when running ant with sonar. I'm not even using those classes on my code. ANy ideas?
[sonar:sonar] Sensor JavaSquidSensor
[sonar:sonar] Configured Java source version (sonar.java.source): 8
[sonar:sonar] JavaClasspath initialization...
[sonar:sonar] JavaClasspath initialization done: 2603 ms
[sonar:sonar] JavaTestClasspath initialization...
[sonar:sonar] JavaTestClasspath initialization done: 2247 ms
[sonar:sonar] Java Main Files AST scan...
[sonar:sonar] 64 source files to be analyzed
[sonar:sonar] Class not found: javax.annotation.Nullable
[sonar:sonar] Class not found: com.google.errorprone.annotations.CanIgnoreReturnValue
[sonar:sonar] Class not found: com.google.errorprone.annotations.concurrent.LazyInit
[sonar:sonar] Class not found: com.google.j2objc.annotations.RetainedWith
[sonar:sonar] Class not found: javax.annotation.Nullable
[sonar:sonar] Class not found: com.google.errorprone.annotations.CanIgnoreReturnValue
[sonar:sonar] Class not found: com.google.errorprone.annotations.concurrent.LazyInit
[sonar:sonar] Class not found: com.google.j2objc.annotations.RetainedWith
[sonar:sonar] 21/64 files analyzed, current file: xxxx
[sonar:sonar] 63/64 files analyzed, current file: xxxx
[sonar:sonar] Java Main Files AST scan done: 21433 ms
[sonar:sonar] 64/64 source files have been analyzed
[sonar:sonar] Java bytecode scan...
[sonar:sonar] Java bytecode scan done: 464 ms
[sonar:sonar] Java Test Files AST scan...
[sonar:sonar] 7 source files to be analyzed
[sonar:sonar] Java Test Files AST scan done: 1689 ms
[sonar:sonar] 7/7 source files have been analyzed
[sonar:sonar] Package design analysis...
[sonar:sonar] Package design analysis done: 26 ms
[sonar:sonar] Sensor JavaSquidSensor (done) | time=29620ms
[sonar:sonar] Sensor Lines Sensor
[sonar:sonar] Sensor Lines Sensor (done) | time=13ms
[sonar:sonar] Sensor CoberturaSensor
Thank you in advance.
This debug information is likely related to n-th level dependencies. This is info-only and printed as a warning that the analysis might not be as detailed as possible because those binaries weren't available to factor in to it.
Related
I'm using the below property to generate JaCoCo XML report
<property name="sonar.coverage.jacoco.xmlReportPaths" value="${basedir}/sonar-task/reports/jacoco.xml" />
When I invoke this ANT Task from Jenkins, I'm seeing the below exception in Jenkins logs and so I don't see the Code Coverage value in SonarQube
15:09:49 [sonar:sonar] Apache Ant(TM) version 1.10.7 compiled on September 1 2019
15:09:49 [sonar:sonar] SonarQube Ant Task version: 2.6.0.1426
.
.
.
15:14:55 [sonar:sonar] Sensor JavaSquidSensor [java] (done) | time=262215ms
15:14:55 [sonar:sonar] Sensor JaCoCo XML Report Importer [jacoco]
15:14:55 [sonar:sonar] Coverage report 'C:\Softwares\Jenkins\workspace\MYA_DevOps_PIPELINE\.\sonar-task\reports\jacoco.xml' could not be read/imported. Error: {}
15:14:55 [sonar:sonar] java.lang.IllegalStateException: Failed to parse JaCoCo XML report: C:\Softwares\Jenkins\workspace\MYA_DevOps_PIPELINE\.\sonar-task\reports\jacoco.xml
15:14:55 [sonar:sonar] at org.sonar.plugins.jacoco.XmlReportParser.parse(XmlReportParser.java:96)
I can see the HTML reports and I can see the jacoco.xml file is getting generated as well. But the content inside this file is not XML.
Just add the below line while you generate an XML JaCoCo report
<xml destfile="${sonar.coverage.jacoco.xmlReportPaths}"/>
sonar.exclusions parameter is not working for Sonarqube, the sonar.exclusions parameter defined in Jenkins or project setting in SonarQube Server it is not taking effect and scanning all files.
I want to exclude CSS,JS and HTML file scanning from the project for that I defined
sonar.exclusions=**/*.css, **/*.js ,**/*.html
also defined the path with root path with Jenkins workspace like
sonar.exclusions=$WORKSPACE/src/**/*.css, $WORKSPACE/src/**/*.js
still no positive result .
Also defined exclusions in sonarQube sever also
Software Stack
SonarQube:7.9.4-community
Jenkins: 2.235.1
Jenkins-plugin: SonarQubeScanner for Jenkins 2.11
SonarQube Scanner:- 3.0.0.702
The Jenkins console output is the following . what mistake I am making here can someone guide me?
Dsonar.coverage.jacoco.xmlReportPaths=/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/build/reports/jacoco/test/jacocoTestReport.xml
Dsonar.sources=/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/src
Dsonar.surefire.reportsPath=/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/
build/test-results/test "-Dsonar.exclusions=**/*.css, **/*.js , **/*.html" -Dsonar.projectVersion=Octane-137020-SonarQube-Integrations -
Dsonar.java.binaries=/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/build/c
lasses -Dsonar.projectKey=LEMS_X_Exclude -
Dsonar.junit.reportPaths=/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/bui
ld/test-results/test
Dsonar.projectBaseDir=/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA
INFO: Scanner configuration file: /opt/cloudhost/apps/.jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQubeScanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.0.0.702
INFO: Java 1.8.0_252 Oracle Corporation (64-bit)
INFO: Linux 3.10.0-1127.10.1.el7.x86_64 amd64
INFO: User cache: /home/stlpdapi/.sonar/cache
INFO: SonarQube server 7.9.4
INFO: Default locale: "en_US", source code encoding: "UTF-8"
WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=119ms
INFO: Server id: E2281BAA-AXPWxgc9dGdpV1spT8iU
INFO: User cache: /home/stlpdapi/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=79ms
INFO: Load/download plugins (done) | time=134ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: LEMS_X_Exclude
INFO: Base dir: /opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA
INFO: Working dir: /opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/.scannerwork
INFO: Load project settings for component key: 'LEMS_X_Exclude'
INFO: Load project settings for component key: 'LEMS_X_Exclude' (done) | time=22ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=75ms
INFO: Detected Jenkins
INFO: Load active rules
INFO: Load active rules (done) | time=747ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Excluded sources: **/*.css, **/*.js, **/*.html
INFO: Load project repositories
INFO: Load project repositories (done) | time=44ms
INFO: 1221 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for java: Sonar way
INFO: Quality profile for jsp: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module LEMS_X_Exclude
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=25ms
INFO: Sensor JavaSquidSensor [java]
INFO: Configured Java source version (sonar.java.source): none
INFO: JavaClasspath initialization
WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.
INFO: JavaClasspath initialization (done) | time=12ms
INFO: JavaTestClasspath initialization
INFO: JavaTestClasspath initialization (done) | time=2ms
INFO: Java Main Files AST scan
INFO: 405 source files to be analyzed
INFO: 28/405 files analyzed, current file: src/main/java/com/mf/pdapi/orm/pojo/SoftwareLicenseStructure.java
INFO: 100/405 files analyzed, current file: src/main/java/com/mf/pdapi/services/pdapi/mappers/response/APGetEntitlementResponseMapper.java
INFO: 168/405 files analyzed, current file: src/main/java/com/mf/pdapi/web/controller/IndexController.java
INFO: 206/405 files analyzed, current file: src/main/java/com/mf/pdapi/web/controller/licensePanination/LicenseController.java
INFO: 258/405 files analyzed, current file: src/main/java/com/mf/pdapi/web/models/ProductVO.java
WARN: Invalid character encountered in file /opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/src/test/java/com/mf/pdapi/services/utils/SecurityHelperUtilTest.java at line 34 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 405/405 source files have been analyzed
INFO: Java Main Files AST scan (done) | time=57784ms
INFO: Java Test Files AST scan
INFO: 0 source files to be analyzed
INFO: Java Test Files AST scan (done) | time=2ms
INFO: 0/0 source files have been analyzed
INFO: Sensor JavaSquidSensor [java] (done) | time=58443ms
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=125ms
INFO: Sensor SonarCSS Rules [cssfamily]
ERROR: CSS rules were not executed. Error when running: 'node -v'. Is Node.js available during analysis?
org.sonarsource.nodejs.NodeCommandException: Error when running: 'node -v'. Is Node.js available during analysis?
at org.sonarsource.nodejs.NodeCommand.start(NodeCommand.java:83)
at org.sonarsource.nodejs.NodeCommandBuilderImpl.getVersion(NodeCommandBuilderImpl.java:196)
at org.sonarsource.nodejs.NodeCommandBuilderImpl.checkNodeCompatibility(NodeCommandBuilderImpl.java:169)
at org.sonarsource.nodejs.NodeCommandBuilderImpl.build(NodeCommandBuilderImpl.java:144)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.initNodeCommand(CssAnalyzerBridgeServer.java:133)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServer(CssAnalyzerBridgeServer.java:101)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServerLazily(CssAnalyzerBridgeServer.java:153)
at org.sonar.css.plugin.CssRuleSensor.execute(CssRuleSensor.java:99)
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:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:99)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
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:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.io.IOException: Cannot run program "node": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at org.sonarsource.nodejs.NodeCommand$ProcessWrapperImpl.start(NodeCommand.java:175)
at org.sonarsource.nodejs.NodeCommand.start(NodeCommand.java:79)
... 37 common frames omitted
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 39 common frames omitted
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=938ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=253ms
INFO: Sensor SurefireSensor [java]
INFO: parsing [/opt/cloudhost/apps/.jenkins/workspace/TEMP_SONARQUBE_CI_CD_LEMS_BUILD_EXTRA/build/test-results/test]
INFO: Sensor SurefireSensor [java] (done) | time=35ms
INFO: Sensor JaCoCoSensor [java]
INFO: Sensor JaCoCoSensor [java] (done) | time=1ms
INFO: Sensor JavaXmlSensor [java]
INFO: 41 source files to be analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=526ms
INFO: Sensor HTML [web]
INFO: 41/41 source files have been analyzed
INFO: Sensor HTML [web] (done) | time=1841ms
INFO: Sensor XML Sensor [xml]
INFO: 52 source files to be analyzed
INFO: Sensor XML Sensor [xml] (done) | time=562ms
INFO: 52/52 source files have been analyzed
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=22ms
INFO: Sensor Java CPD Block Indexer
INFO: Sensor Java CPD Block Indexer (done) | time=640ms
INFO: 78 files had no CPD blocks
INFO: Calculating CPD for 427 files
INFO: CPD calculation finished
INFO: Analysis report generated in 378ms, dir size=9 MB
INFO: Analysis report compressed in 1574ms, zip size=3 MB
INFO: Analysis report uploaded in 263ms
The error is:
ERROR: CSS rules were not executed. Error when running: 'node -v'. Is Node.js available during analysis?
It means what you do not have nodejs installed. Just configure it in jenkins global tools menu, add it to your job and run it again.
I'm trying to setup SonarQube with Xanitizer on my local machine so that the findings of the last generated Security Findings XML, get picked up by the SonarQube Plugin for Xanitizer so that it can display the results on the SonarQube server.
The analysis of the files and the generation of the report is done manually from within the Xanitizer software. The XML file is generated under the parent unzipped directory of Xanitizer, and not inside the SonarQube or the Sonar Scanner directories.
The Xanitizer plug-in is configured with SonarQube and I can see the Xanitizer rules getting added on the Sonar server. However, while running the Sonar Scanner Ant Task, it is supposed to read and parse the Security-Findings-List.XML file, but an Exception is thrown during the running of the Ant task with the below stacktrace -
[sonar:sonar] Sensor NoSonar Sensor [php] (done) | time=0ms
[sonar:sonar] Sensor XanitizerSensor [xanitizer]
[sonar:sonar] Reading Xanitizer findings from 'D:\SonarFiles\Xanitizer-3.1.0\KeurigHybrisSecurity-Findings-List.xml' for project 'Hybris Java Project analyzed with the Sonar Ant Task'
[sonar:sonar] Exception caught while parsing Xanitizer XML report file 'D:\SonarFiles\Xanitizer-3.1.0\KeurigHybrisSecurity-Findings-List.xml'.
[sonar:sonar] javax.xml.parsers.ParserConfigurationException: FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present.
[sonar:sonar] at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source)
[sonar:sonar] at com.rigsit.xanitizer.sqplugin.reportparser.XMLReportParser.parse(XMLReportParser.java:58)
[sonar:sonar] at com.rigsit.xanitizer.sqplugin.XanitizerSensor.analyse(XanitizerSensor.java:120)
[sonar:sonar] at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
[sonar:sonar] at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
[sonar:sonar] at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
[sonar:sonar] at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
[sonar:sonar] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
[sonar:sonar] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
[sonar:sonar] at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
[sonar:sonar] at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
[sonar:sonar] at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
[sonar:sonar] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
[sonar:sonar] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
[sonar:sonar] at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
[sonar:sonar] at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
[sonar:sonar] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
[sonar:sonar] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
[sonar:sonar] at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
[sonar:sonar] at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
[sonar:sonar] at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
[sonar:sonar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sonar:sonar] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[sonar:sonar] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[sonar:sonar] at java.lang.reflect.Method.invoke(Unknown Source)
[sonar:sonar] at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[sonar:sonar] at com.sun.proxy.$Proxy0.execute(Unknown Source)
[sonar:sonar] at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
[sonar:sonar] at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
[sonar:sonar] at org.sonarsource.scanner.ant.SonarQubeTask.launchAnalysis(SonarQubeTask.java:99)
[sonar:sonar] at org.sonarsource.scanner.ant.SonarQubeTask.execute(SonarQubeTask.java:81)
[sonar:sonar] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[sonar:sonar] at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
[sonar:sonar] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[sonar:sonar] at java.lang.reflect.Method.invoke(Unknown Source)
[sonar:sonar] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[sonar:sonar] at org.apache.tools.ant.Task.perform(Task.java:348)
[sonar:sonar] at org.apache.tools.ant.Target.execute(Target.java:435)
[sonar:sonar] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[sonar:sonar] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[sonar:sonar] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[sonar:sonar] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[sonar:sonar] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
[sonar:sonar] at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[sonar:sonar] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:452)
[sonar:sonar] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:139)
[sonar:sonar] Sensor XanitizerSensor [xanitizer] (done) | time=2ms
[sonar:sonar] Sensor Coverage Report Import [csharp]
As a result the Xanitizer findings do not get reflected on the Sonar Server. I was not able to find any resolution on the internet. How can I resolve this issue?
Versions of softwares used -
sonarqube-6.3.1,
Xanitizer-3.1.0,
sonar-scanner-3.0.1.733-windows
What JDK version are you using? I can not reproduce this exception with Java 8 (all other tool versions are the same).
Nevertheless, it looks like a bug in the plugin, so please file a bug report here https://github.com/RIGS-IT/sonar-xanitizer/issues or send an e-mail with the additional information to support#xanitizer.net
Stackoverflow is not the right platform for this, I think ;)
Regards
Norman (Xanitizer support)
I am trying to generate code coverage for webapp for manual testing using jacoco and sonar.
I am able to generate jacoco.exec file by modifying the catalina.bat in following way:
SET JACOCO=-javaagent:\jacoco-0.7.5.201505241946\lib\jacocoagent.jar=destfile=C:\jacoco.exec,append=true,includes=*
set JAVA_OPTS=%JAVA_OPTS% %JACOCO%
I then copy the jacoco.exec file to a target folder inside sonarcube and run ant sonar. The build.xml has following entries:
<!-- The following properties are required to use JaCoCo: -->
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<property name="sonar.java.coveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="target/jacoco.exec" />
<!-- Define the SonarQube target -->
<target name="sonar">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<!-- Update the following line, or put the "sonar-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path="../apache-ant-1.9.6/lib/sonar-ant-task-2.3.jar"/>
</taskdef>
<!-- Execute the SonarQube analysis -->
<sonar:sonar/>
</target>
</project>
The output I get from ant if following. I don't see any coverage in the report at the url
http://localhost:9000/dashboard/index/org.codehaus.sonar:example-java-ant
Am I missing something?
c:\sonarqube>ant sonar
Buildfile: c:\sonarqube\build.xml
sonar:
[sonar:sonar] Apache Ant(TM) version 1.9.6 compiled on June 29 2015
[sonar:sonar] SonarQube Ant Task version: 2.3
[sonar:sonar] Loaded from: file:/C:/apache-ant-1.9.6/lib/sonar-ant-task-2.3.jar
[sonar:sonar] INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
[sonar:sonar] INFO: Work directory: c:\sonarqube\.sonar
[sonar:sonar] INFO: SonarQube Server 5.2
[sonar:sonar] 17:18:52.370 INFO - Load global repositories
[sonar:sonar] 17:18:52.959 INFO - Load global repositories (done) | time=588ms
[sonar:sonar] 17:18:53.034 INFO - User cache: C:\Users\Administrator\.sonar\cache
[sonar:sonar] 17:18:53.932 INFO - Load plugins index
[sonar:sonar] 17:18:53.952 INFO - Load plugins index (done) | time=20ms
[sonar:sonar] 17:18:54.677 INFO - Process project properties
[sonar:sonar] 17:18:57.381 INFO - Load project repositories
[sonar:sonar] 17:18:57.493 INFO - Load project repositories (done) | time=112ms
[sonar:sonar] 17:18:57.535 INFO - Apply project exclusions
[sonar:sonar] 17:18:57.667 INFO - Load quality profiles
[sonar:sonar] 17:18:57.983 INFO - Load quality profiles (done) | time=315ms
[sonar:sonar] 17:18:58.039 INFO - Load active rules
[sonar:sonar] 17:19:00.610 INFO - Load active rules (done) | time=2571ms
[sonar:sonar] 17:19:00.636 WARN - 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used.
[sonar:sonar] 17:19:00.797 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.
scm.provider to define SCM of your project.
[sonar:sonar] 17:19:00.800 INFO - Publish mode
[sonar:sonar] 17:19:00.805 INFO - ------------- Scan Simple Java Project analyzed with the SonarQube Ant Task
[sonar:sonar] 17:19:01.844 INFO - Language is forced to java
[sonar:sonar] 17:19:01.887 INFO - Load server rules
[sonar:sonar] 17:19:02.373 INFO - Load server rules (done) | time=486ms
[sonar:sonar] 17:19:02.755 INFO - Base dir: c:\sonarqube
[sonar:sonar] 17:19:02.756 INFO - Working dir: c:\sonarqube\.sonar
[sonar:sonar] 17:19:02.781 INFO - Source paths: src
[sonar:sonar] 17:19:02.786 INFO - Source encoding: windows-1252, default locale: en_US
[sonar:sonar] 17:19:02.787 INFO - Index files
[sonar:sonar] 17:19:02.854 INFO - 0 files indexed
[sonar:sonar] 17:19:02.857 INFO - Quality profile for java: Sonar way
[sonar:sonar] 17:19:02.999 INFO - Sensor Lines Sensor
[sonar:sonar] 17:19:03.005 INFO - Sensor Lines Sensor (done) | time=6ms
[sonar:sonar] 17:19:03.006 INFO - Sensor QProfileSensor
[sonar:sonar] 17:19:03.095 INFO - Sensor QProfileSensor (done) | time=89ms
[sonar:sonar] 17:19:03.096 INFO - Sensor SCM Sensor
[sonar:sonar] 17:19:03.097 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
[sonar:sonar] 17:19:03.100 INFO - Sensor SCM Sensor (done) | time=4ms
[sonar:sonar] 17:19:03.100 INFO - Sensor Code Colorizer Sensor
[sonar:sonar] 17:19:03.106 INFO - Sensor Code Colorizer Sensor (done) | time=6ms
[sonar:sonar] 17:19:03.107 INFO - Sensor CPD Sensor
[sonar:sonar] 17:19:03.108 INFO - JavaCpdEngine is used for java
[sonar:sonar] 17:19:03.110 INFO - Sensor CPD Sensor (done) | time=3ms
[sonar:sonar] 17:19:03.304 INFO - Analysis reports generated in 192ms, dir size=5 KB
[sonar:sonar] 17:19:03.320 INFO - Analysis reports compressed in 15ms, zip size=2 KB
[sonar:sonar] 17:19:03.758 INFO - Analysis reports sent to server in 424ms
[sonar:sonar] 17:19:03.762 INFO - ANALYSIS SUCCESSFUL, you can browse
Looking at log of analysis we cannot see any JaCoCo sensor executed. JaCoCo sensor is executed only if you have java file in your analysis which you don't as you can see per 0 files indexed line in your log.
To explain this behaviour you have to understand that JaCoCo sensor will only report coverage on files indexed so if there are no java files, there is no point to execute it.
So to report and compute coverage you would have to import a coverage report related to some source files you analyze in your project.
I use
Sonar Qube - 4.4.1
JDK Version 1.7
Sonar Ant Task version: 2.1 - I was able to launch my sonar server successfully and when I try to execute my build.xml with ant, I"m getting below error - could someone help please:
sonar:
[sonar:sonar] Apache Ant(TM) version 1.9.6 compiled on June 29 2015
[sonar:sonar] Sonar Ant Task version: 2.1
[sonar:sonar] Loaded from: file:/D:/NEW_SONARQUBE_HOME/sonar-ant-task- 2.1.jar
[sonar:sonar] INFO: Default locale: "en_GB", source code encoding: "UTF-8"
[sonar:sonar] INFO: Work directory: D:\ATG9.1\DWInt\CoreCommerce\.sonar
[sonar:sonar] INFO: Sonar Server 4.4.1
BUILD FAILED
D:\NEW_SONARQUBE_HOME\buildCoreCommerce.xml:28: java.lang.IllegalStateException:
Fail to download libraries from server
at org.sonar.runner.impl.Jars35.dowloadFiles(Jars35.java:79)
at org.sonar.runner.impl.Jars35.download(Jars35.java:58)
at org.sonar.runner.impl.JarDownloader.download35(JarDownloader.java:56)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:59)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:57)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:71)