Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SonarQube不';t使用IntelliJ和Maven分析主要java代码_Java_Maven_Intellij Idea_Sonarqube - Fatal编程技术网

SonarQube不';t使用IntelliJ和Maven分析主要java代码

SonarQube不';t使用IntelliJ和Maven分析主要java代码,java,maven,intellij-idea,sonarqube,Java,Maven,Intellij Idea,Sonarqube,我在我的项目中使用IntelliJ with Maven,我必须使用SonarQube进行分析,但是当我使用webApp提供的命令扫描我的项目时,它只分析pom.xml文件,而忽略了项目的其余部分 清洁安装sonar:sonar-Dsonar.host.url=-Dsonar.login=“此处对应的键” My pom.xml(项目标记中的内容): cl.itau.simulacionCredito Maven配置文件中的My settings.xml: <pluginGroups&g

我在我的项目中使用IntelliJ with Maven,我必须使用SonarQube进行分析,但是当我使用webApp提供的命令扫描我的项目时,它只分析pom.xml文件,而忽略了项目的其余部分

清洁安装sonar:sonar-Dsonar.host.url=-Dsonar.login=“此处对应的键”

My pom.xml(项目标记中的内容):

cl.itau.simulacionCredito

Maven配置文件中的My settings.xml:

<pluginGroups>
    <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
  </pluginGroups>

  <proxies>
  </proxies>

  <servers>
  </servers>

  <mirrors>
  </mirrors>

  <profiles>
    <profile>
       <id>sonar</id>
       <activation>
           <activeByDefault>true</activeByDefault>
       </activation>
       <properties>
           <sonar.host.url>
             http://localhost:9000
           </sonar.host.url>
        </properties>
     </profile>
  </profiles>

org.sonarsource.scanner.maven
声纳
符合事实的
http://localhost:9000
我一直在向POM添加内容,因为在尝试修复此问题时出现了不同的错误


我安装了最新版本的SonarQube。

SonarQube通过分析jacoco输出来工作。我在你的pom中没有看到jacoco的配置。这是一个关于如何设置它的好教程

您还必须告诉sonarqube您的jacoco.exec文件在哪里。
因此,问题是IntelliJ配置了Java SE开发工具包11,我降级到Java SE开发工具包8u181,并配置了POM,以便Maven能够处理该更改,我再次执行了扫描仪,它工作了

对pom.xml的更改:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <sonar.sources>src/main/java</sonar.sources>
</properties>

1.8
1.8
src/main/java
增加:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
         <version>3.8.0</version>
         <configuration>
            <source>8</source>
            <target>8</target>
         </configuration>
</plugin>

org.apache.maven.plugins

您是否也在本地主机上的SonarQube安装中安装了Java analyzer?(我不记得默认情况下它是否在那里,或者你是否必须在你的安装中安装/启用它,以便在它分析的项目中使用…@moilejter SonarJava默认情况下它在那里(我必须更新它)你能在启用调试(
-X
)的情况下发布maven的输出吗?SonarQube可以分析比JaCoCo报告多得多的内容,它还分析源代码。覆盖率只是众多指标之一。
<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <sonar.sources>src/main/java</sonar.sources>
</properties>
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
         <version>3.8.0</version>
         <configuration>
            <source>8</source>
            <target>8</target>
         </configuration>
</plugin>