SonarQube 7.6 中删除了任务支持

问题描述 投票:0回答:3

我尝试使用 Dockerfile 安装

sonar-scanner-cli
,但出现以下错误:

INFO: Scanner configuration file: /usr/lib/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.4.0.2170
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 5.4.17-2011.0.7.el7uek.x86_64 amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /usr/lib/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 7.7.0
INFO: Load global settings
INFO: Load global settings (done) | time=62ms
INFO: Server id: BF41A1F2-AWoRdxW1J_VH_hnihanC
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=39ms
INFO: Load/download plugins (done) | time=937ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.300s
INFO: Final Memory: 4M/17M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Tasks support was removed in SonarQube 7.6.
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

这是我的 Dockerfile 和

sonar-runner.properties
文件:

FROM sonatypenexus.com:19443/ubuntu:20.04

COPY ./nexus.list /etc/apt/sources.list.d/
RUN mkdir -p /usr/lib/jvm; \
    apt update; \
    apt install -y openjdk-11-jdk;

ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV PATH $PATH:/usr/lib/jvm/java-11-openjdk-amd64/bin

RUN echo $JAVA_HOME; \
    echo $PATH; \
    java -version;

RUN apt install -y git;
RUN apt-get install maven -y;
RUN apt-get install docker.io -y;
RUN docker --version;
RUN apt-get install -y curl tmux htop sudo unzip wget;

# Set timezone to CST
ENV TZ=America/Chicago
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY ./sonar-scanner-cli-4.4.0.2170-linux.zip /usr/src/sonarscanner.zip

WORKDIR /usr/src

RUN unzip sonarscanner.zip && \
    rm sonarscanner.zip && \
    mv sonar-scanner-4.4.0.2170-linux /usr/lib/sonar-scanner && \
  ln -s /usr/lib/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner

ENV SONAR_RUNNER_HOME=/usr/lib/sonar-scanner
COPY sonar-runner.properties /usr/lib/sonar-scanner/conf/sonar-scanner.properties
ENTRYPOINT ["sonar-scanner"]
CMD ["-Dsonar.projectBaseDir=/usr/src"]

这是我的 sonar-runner.properties 文件:

sonar.host.url=http://uxunt:8080/sonarqube

sonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar
sonar.projectKey=MyProjectKey
sonar.projectName=My Project Name
sonar.projectVersion=1
sonar.projectBaseDir=/usr/src
sonar.sources=./
jenkins sonarqube dockerfile devops sonarqube-scan
3个回答
3
投票

根据SonarSourve社区的答案,这里这里,我猜你应该引用

sonar.projectName='My Project Name'

这实际上不是关于您的分析参数,而是关于您的 分析命令。

命令行上有一些您可能想要的东西 一个参数,但不以破折号 (-) 为前缀。因为有 没有破折号,扫描仪将其解释为参数/任务。


0
投票

尝试一下这个方法可能会有所帮助。 将项目令牌与 sonars-scanner 命令一起放置。 -X 用于调试。

Windows

C:\xxx\xxx\xxx\sonar-scanner-4.8.0.2856-windows in> sonar-scanner -Dsonar.token=//放入你的项目密钥// -X


0
投票

我收到

Tasks support was removed in SonarQube 7.6
错误,因为我在
sonar.token
文件中写入了
sonar-project.properties

通过向扫描仪提供令牌作为选项来解决这个问题

例如:

sonar-scanner -Dsonar.token=sqp_xxxxx -Dsonar.sources=.

© www.soinside.com 2019 - 2024. All rights reserved.