有人可以帮助我完成声纳设置吗?我有一个JavaScript库,它既有一个前端文件夹又有一个后端文件夹,每个文件夹都有自己的node_modules。我想将它们设置为1个sonarqube项目的模块。我可以运行我的声纳扫描仪,但是即使看起来可以找到正确的基本sonar-project.properties,它也可以永久挂在执行项目的构建器上。
在gitlab配置中,我先执行npm install
,然后执行npm run sonar-scanner
。该npm任务运行node_modules / sonar-scanner / bin / sonar-scanner可执行文件。我没有将任何参数传递给声纳扫描仪,而是依靠sonar-project.properties文件。这是我的文件夹结构:
main
sonar-project.properties
backend
sonar-project.properties
这是我的主要sonar-project.properties:
sonar.projectKey=mykey
sonar.sources=.
sonar.host.url=http://34.230.xx.xx
sonar.login=key
sonar.gitlab.project_id=$CI_PROJECT_PATH
sonar.gitlab.commit_sha=$CI_COMMIT_REF
sonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
sonar.analysis.mode=preview
sonar.modules=Backend
Backend.sonar.projectConfigFile=backend/sonar-project.properties
这是我的backend / sonar-project.properties:
sonar.projectName=Backend
sonar.projectBaseDir=..
> user@1.0.0 sonar-scanner /builds/user/repoName
> node_modules/sonar-scanner/bin/sonar-scanner
INFO: Scanner configuration file: /builds/user/repoName/node_modules/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/user/repoName/sonar-project.properties
INFO: SonarQube Scanner 3.1.0.1141
INFO: Java 1.8.0_171 Oracle Corporation (64-bit)
INFO: Linux 4.14.48-coreos-r2 amd64
INFO: User cache: /root/.sonar/cache
INFO: SonarQube server 7.0.0
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Issues mode
WARN: 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=130ms
INFO: Server id: yyy-xxxx
INFO: User cache: /root/.sonar/cache
INFO: Exclude plugins: devcockpit, ldap, authgithub, authbitbucket, pdfreport, authaad, googleanalytics, governance
INFO: Load plugins index
INFO: Load plugins index (done) | time=60ms
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=328ms
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=165ms
INFO: Scanning only changed files
INFO: Execute project builders