jenkins SonarQube 7.6中删除了任务支持

rt4zxlrg  于 2023-08-03  发布在  Jenkins
关注(0)|答案(2)|浏览(192)

我尝试使用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=./

fgw7neuy

fgw7neuy1#

根据SonarSourve社区中的答案,herehere,我猜你应该引用sonar.projectName='My Project Name'
这实际上与分析参数无关,而是与分析命令有关。
您在命令行上有一些东西,您可能打算将其作为参数,但它没有以破折号(-)作为前缀。因为没有破折号,扫描器将其解释为参数/任务。

qf9go6mv

qf9go6mv2#

试试这种方式,可能会有帮助。将项目令牌与sonars-scanner命令放在沿着。-X表示调试。

Windows

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

相关问题