Comments (9)
You need a sonar-project.properties
file, with the sonar.projectKey
set, among others. Here's an example sonar-project.properties
file:
# sonar project id
sonar.projectKey=YOUR_SONAR_PROJECT_KEY_ID
# main language to be analyzed
sonar.language=php
# included folders
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=config, plugins, src
# excluded folders
sonar.exclusions=plugins/**/tests/**, src/Console/Installer.php, plugins/**/config/**, config/Migrations/**
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Set gitlab analysis to exit instead of notifying via commit message
sonar.gitlab.failure_notification_mode=exit-code
You can see more information about this file in: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
Please, don't close the issue as we'll try to add a note about this file our readme file.
from gitlab-sonar-scanner.
Thanks for reply
i create sonar-project.properties file
Picture (dev)
http://imgur.com/UjHFgpXl.png
# sonar project id
sonar.projectKey=Krusher
# main language to be analyzed
sonar.language=JavaScript
# included folders
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=config, plugins, src
# excluded folders
sonar.exclusions=plugins/**/tests/**, src/Console/Installer.php, plugins/**/config/**, config/Migrations/**
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Set gitlab analysis to exit instead of notifying via commit message
sonar.gitlab.failure_notification_mode=exit-code
BUT STILL the same issue
Cloning repository...
Cloning into '/builds/satskiy.a/KRUSHER'...
Checking out 15883a03 as dev...
Skipping Git submodules setup
$ unset CI_BUILD_REF && /usr/bin/sonar-scanner-run.sh
INFO: Scanner configuration file: /sonar-scanner-3.0.3.778/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_131 Oracle Corporation (64-bit)
INFO: Linux 4.11.12-coreos-r1 amd64
INFO: User cache: /root/.sonar/cache
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=722ms
INFO: User cache: /root/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=176ms
INFO: Download sonar-flex-plugin-2.3.jar
INFO: Download sonar-scm-git-plugin-1.2.jar
INFO: Download sonar-gitlab-plugin-2.1.0.jar
INFO: Download sonar-l10n-ru-plugin-1.6.jar
INFO: Download sonar-scm-svn-plugin-1.5.0.715.jar
INFO: Download sonar-javascript-plugin-3.2.0.5506.jar
INFO: Download sonar-java-plugin-4.15.0.12310.jar
INFO: SonarQube server 6.6.0
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 8.319s
INFO: Final Memory: 45M/178M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.sources
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Maybe wrong place ?
Thanks
from gitlab-sonar-scanner.
Your runner is not taking the sonar-project.properties
. Take a look to the line which says:
INFO: Scanner configuration file: /sonar-scanner-3.0.3.778/conf/sonar-scanner.properties
Now take a look to the first comment you wrote. Both have exactly the same path, so, obviously, your runner is not taking the sonar-project.properties
file.
Is that file added to the root of the project, commited, and pushed?
from gitlab-sonar-scanner.
yes
check a picture
http://imgur.com/UjHFgpXl.png
from gitlab-sonar-scanner.
Please, paste here how have you configured the runner in .gitlab-ci.yml
(replace any sensible information with ** if required).
from gitlab-sonar-scanner.
stages:
- analysis
sonarqube:
stage: analysis
image: ciricihq/gitlab-sonar-scanner
variables:
SONAR_URL: "https://www.krusher.duckdns.org"
SONAR_PROJECT_VERSION: "$CI_BUILD_ID"
SONAR_ANALYSIS_MODE: "issues"
script:
- /usr/bin/sonar-scanner-run.sh
sonarqube-reports:
stage: analysis
image: ciricihq/gitlab-sonar-scanner
variables:
SONAR_URL: "https://www.krusher.duckdns.org"
SONAR_PROJECT_VERSION: "$CI_BUILD_ID"
SONAR_ANALYSIS_MODE: "publish"
script:
- unset CI_BUILD_REF && /usr/bin/sonar-scanner-run.sh
from gitlab-sonar-scanner.
# must be unique in a given SonarQube instance
sonar.projectKey=Krusher
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Webfax
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
working exammple!!!!
from gitlab-sonar-scanner.
What do you mean with "working example"? Did you finally got it working?
from gitlab-sonar-scanner.
Currently available under the develop
docker tag.
from gitlab-sonar-scanner.
Related Issues (20)
- sonar scanner failed with exception GitLab is not responding HOT 12
- Get exception when analysis typescript code. HOT 2
- API V3 is no longer supported. Use API V4 instead HOT 1
- Create proper docker tags per SonarQube version HOT 3
- How to fail GitLab CI Job if sonar scanner find a major issue?
- Remove the sonar-scanner-cli zip from the Image
- Define a default command or entrypoint for the Image HOT 4
- Docker builds failing since 3.1.0 HOT 1
- Unable to find valid certification path to requested target HOT 5
- Update deprecated environment variables
- Incompatibility with sonar 7.7 HOT 4
- sonar-scanner-run.sh only pass the first argument
- Missing koalaman/shellcheck for inspecting shell scripts
- Unexpected external job to the pipeline HOT 2
- Nodejs works correctly, but not Typescript HOT 1
- SonarQube localhost server unable to reach HOT 1
- java.nio.file.NoSuchFileException
- Uploading coverage report? HOT 2
- New version proposal HOT 3
- Archive this project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitlab-sonar-scanner.