SonarQube-MVN声纳:声纳-NoSuchElementException

时间:2020-01-22 16:06:10

标签: java maven sonarqube

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

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

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

我具有以下项目结构:

  • 项目名称
    • Dal
    • SharedModel
    • WebsocketClient
    • WebsocketServer

因此,我总共有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>

1 个答案:

答案 0 :(得分:0)

您的命令是错误的:

mvn sonar : sonar   // WRONG

去除声纳和声纳之间的间隔,并添加声纳服务器地址:

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

也可以在pom.xml文件(在属性部分中添加)中配置声纳服务器配置

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