繁体   English   中英

SonarQube - mvn 声纳:声纳 - NoSuchElementException

[英]SonarQube - mvn sonar : sonar - NoSuchElementException

我在 SonarQube 上有一个项目,但是当我尝试在终端中使用以下命令更新它时,出现了这个错误:

[ERROR] NoSuchElementException [ERROR] [ERROR] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。 [错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。

我在网上搜索过,但显然没有人知道答案,所以我想我会试一试。

我有以下项目结构:

  • 项目名
    • 木豆
    • 共享模型
    • Websocket客户端
    • Websocket服务器

所以我总共有 4 个模块。 我的主要 pom.xml 看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
  </parent>
  <groupId>myproject.nl</groupId>
  <artifactId>myproject</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>
  <modules>
    <module>websocketserver</module>
    <module>websocketsclient</module>
    <module>sharedmodel</module>
    <module>Dal</module>
  </modules>
  <name>PartieKo</name>


  <dependencies>
    <!-- https://mvnrepository.com/artifact/log4j/log4j -->
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>
    <!-- JUnit 5 -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.5.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>11</source>
          <target>11</target>
        </configuration>

      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M3</version>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>

你的命令是错误的:

mvn sonar : sonar   // WRONG

去掉sonar和sonar之间的间隔符,添加Sonar服务器地址:

mvn sonar:sonar -Dsonar.host.url=https://mysonarserver:9000

sonar server配置也可以在pom.xml文件中配置(在properties部分添加)

<properties>
    ...
    <sonar.host.url>https://mysonarserver:9000</sonar.host.url>
</properties>

在 windows 上命令 mvn sonar scanner

mvn sonar:sonar `
  "-Dsonar.projectKey=xxxxx" `
  "-Dsonar.host.url=http://local:9000" `
  "-Dsonar.login=xxxxxxxxx"

Linux 在声纳控制台手动添加项目后,声纳会给你下一个命令。

mvn sonar:sonar \
  "-Dsonar.projectKey=xxxxx" \
  "-Dsonar.host.url=http://localhost:9000" \
  "-Dsonar.login=xxxxxxxxx"

您还可以将 url/host/login 放在 pom 文件或 env 配置中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM