Error while trying to run sonar scanner

scanner

(Lucas Moreira dos Santos) #1

Hi. I started to use Sonarqube today and I’m trying to scan a java project using sonar-scanner.
I’ve already created the file sonar-scanner.properties in my project folder and my Sonarqube server is running.

When I used CMD to run the scanner, it showed me this error:

INFO: Scanner configuration file: C:\sonar-scanner-3.2.0.1227-windows\bin\..\con
f\sonar-scanner.properties
INFO: Project root configuration file: C:\b2b\hybris\bin\custom\b2bsappricing\so
nar-project.properties
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\santl60\.sonar\cache
INFO: SonarQube server 6.7.4
INFO: Default locale: "pt_BR", source code encoding: "UTF-8"
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=93ms
INFO: Server id: AWTNCr_uQVKYyDlHI7DE
INFO: User cache: C:\Users\santl60\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=79ms
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=12ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=36ms
INFO: Load active rules
INFO: Load active rules (done) | time=580ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=36ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this
project. Please use sonar.scm.provider to define SCM of your project.
INFO: Project key: b2bsappricing
INFO: -------------  Scan b2bsappricing
INFO: Load server rules
INFO: Load server rules (done) | time=241ms
INFO: Base dir: C:\b2b\hybris\bin\custom\b2bsappricing
INFO: Working dir: C:\b2b\hybris\bin\custom\b2bsappricing\.scannerwork
INFO: Source paths: .
INFO: Source encoding: UTF-8, default locale: pt_BR
INFO: Language is forced to java
INFO: Index files
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.classpath' is ignored becaus
e it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.springBeans' is ignored beca
use it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\build.xml' is ignored because
 it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\buildcallbacks.xml' is ignore
d because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\b2bsappricing\Generat
edTypeInitializer.class' is ignored because it doesn't belong to the forced lang
uage 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.project' is ignored because
it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.pmd' is ignored because it d
oesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\constants\B2bsappricingConstants.class' is ignored because it do
esn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\B2bsappricingStandalone.class' is ignored because it doesn't bel
ong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\jalo\B2bsappricingTest.class' is ignored because it doesn't belo
ng to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\jalo\B2bsappricingManager.class' is ignored because it doesn't b
elong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\constants\GeneratedB2bsappricingConstants.class' is ignored beca
use it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\jalo\GeneratedB2bsappricingManager.class' is ignored because it
doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\services\impl\DefaultB2BSapPartnerService.class' is ignored beca
use it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\extensioninfo.xml' is ignored
 because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\extensioninfo.xsd' is ignored
 because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\services\impl\DefaultB2BSapPartnerServiceTest.class' is ignored
because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\platformhome.properties' is i
gnored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\project.properties' is ignore
d because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing\b2bsa
ppricing-testclasses.xml' is ignored because it doesn't belong to the forced lan
guage 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing\dummy
.txt' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing-items
.xml' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing-beans
.xml' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing-sprin
g.xml' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing.build
.number' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\beans.xsd' is ignor
ed because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\items.xsd' is ignor
ed because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_de.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_en.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_es.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_ja.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_fr.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_ko.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_pt.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_ru.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_zh.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\ruleset.xml' is ignored becau
se it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\sonar-project.properties' is
ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_it.properties' is ignored because it doesn't belong to the force
d language 'java'
INFO: 9 files indexed
INFO: Quality profile for java: EC-hybris-Java
INFO: Sensor JavaSquidSensor [java]
INFO: Configured Java source version (sonar.java.source): none
INFO: JavaClasspath initialization
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 9.018s
INFO: Final Memory: 15M/238M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Please provide compiled classes of your project with sonar.java.binaries
property
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging

I’d like to understand how can I have this sonar.java.binaries and how to make scanner work? .


(G Ann Campbell) #2

Hi,

What’s your build system? If you’re using Maven or Gradle, then you should use the relevant versions of SonarQube Scanner: SonarQube Scanner for Maven, or SonarQube Scanner for Gradle. Use either one and the path to your binaries will be configured automatically. Failing that, use the sonar.java.binaries property to point to the location of your .class files.

Ann


(Lucas Moreira dos Santos) #3

Whirlpool’s build system doesn’t use maven or gradle. Do you know could I do that without one of these build systems?

Lucas


(G Ann Campbell) #4

Hi,

As I said before:


(Lucas Moreira dos Santos) #5

Ops sorry. I mesread that point.

Thanks


(Lucas Moreira dos Santos) #6

Good morning Ann.

I ran the scanner but it’s showing me this:

 08:43:33.870 INFO: 826/4869 files analyzed, current file: C:\b2b\hybris\bin\cust
om\hybris\config\hybris\extensions\whrnetpaypaymentaddon\src\com\whirlpool\digit
alplatform\component\renderer\NetPayTagScriptComponentRenderer.java
08:43:33.943 DEBUG: .class not found for de.hybris.platform.addonsupport.rendere
r.impl.DefaultAddOnCMSComponentRenderer
08:43:34.385 DEBUG: .class not found for de
08:43:34.812 DEBUG: .class not found for de.hybris
08:43:35.273 DEBUG: .class not found for de.hybris.platform
08:43:35.695 DEBUG: .class not found for de.hybris.platform.cms2
08:43:36.127 DEBUG: .class not found for de.hybris.platform.cms2.servicelayer
08:43:36.598 DEBUG: .class not found for de.hybris.platform.cms2.servicelayer.se
rvices
08:43:37.056 DEBUG: .class not found for de.hybris.platform.cms2.servicelayer.se
rvices.CMSComponentService
08:43:37.463 DEBUG: .class not found for de
08:43:37.900 DEBUG: .class not found for de.hybris
08:43:38.303 DEBUG: .class not found for de.hybris.platform
08:43:38.707 DEBUG: .class not found for de.hybris.platform.servicelayer
08:43:39.133 DEBUG: .class not found for de.hybris.platform.servicelayer.excepti
ons
08:43:39.609 DEBUG: .class not found for de.hybris.platform.servicelayer.excepti
ons.AttributeNotSupportedException
08:43:40.006 DEBUG: .class not found for de
08:43:40.444 DEBUG: .class not found for de.hybris
08:43:40.862 DEBUG: .class not found for de.hybris.platform
08:43:41.272 DEBUG: .class not found for de.hybris.platform.servicelayer
08:43:41.664 DEBUG: .class not found for de.hybris.platform.servicelayer.model
08:43:42.079 DEBUG: .class not found for de.hybris.platform.servicelayer.model.M
odelService

But the project that I’m analyzing has the java classes. Maybe is any configuration on sonar-project.properties?

# must be unique in a given SonarQube instance
sonar.projectKey=project:testcustom

# this is the name displayed in the SonarQube UI
sonar.projectName=custom
sonar.projectVersion=1.0

sonar.sources=.
sonar.language=java

sonar.inclusions=**/*.java
sonar.exclusions=**/*Test*.java,**/jalo/**,**/gensrc/**
sonar.java.binaries=**/classes/**

(G Ann Campbell) #7

Hi,

Are those classes provided by your project or by a library?

Ann


(Adam Gabryś) #8

SAP Commerce Cloud uses ant as a build system. It has its own file structure and dependency resolution mechanism. There is no official standalone scanner at this moment. I don’t know which version of the platform you are using, but newer versions provide ant targets:

  • sonar - scan all extensions
  • sonarsingle - scan single extension

I’ve never used them, but I’ll give you some hints. First open shell and go into hybris/bin/platform. Next execute ant sonarsingle with parameters:

 -Dsonar.host.url=<your-server>
 -Dsonar.login=<authentication-token or username>
 -Dsonar.password=<password> (only if you don't use the authentication token)
 -Dextensions=b2bsappricing
 -Dsonar.projectKey=project:testcustom (by default "b2bsappricingkey")
 -Dsonar.projetName=custom (by default "b2bsappricing EC-Module")
 -Dsonar.projectVersion=1.0 (be default "1.0")

Platform knows its own file structure, so it generates correct values of sonar.java.libraries, sonar.java.binaries etc.


(Lucas Moreira dos Santos) #9

Hi Aga. Thank you for your help. I could successfuly scan my project (it took us 2 days scanning one singular project)
Do you know how to export the report as pdf or something like that?


(Nicolas Bontoux) #10

5 posts were split to a new topic: Export PDF report for developers


(G Ann Campbell) #11

A post was split to a new topic: Fail to download plugin [ruby]