声纳上没有出现新分支

no new branch appearing on sonar

我尝试在声纳上设置拉取请求分析。我收到错误 "Pull request with branch does not exist on server: develop"。根据 可以使用 sonar.branch.name 属性.

创建一个新的 b运行ch

所以我运行

mvn sonar:sonar -Dsonar.organization=edemo -Dsonar.analysis.mode=issues -Dsonar.branch.name=develop

我的~/.m2/settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<settings>
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>https://sonarqube.com</sonar.host.url>
                <sonar.login>[A sonar login token]</sonar.login>
            </properties>
        </profile>
     </profiles>
</settings>

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">
[...]
  <properties>
[...]
    <sonar.github.repository>edemo/PDEngine</sonar.github.repository>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.7.2</version>
        <configuration>
          <b>
            <argLine>
              -javaagent:${sonar.jacoco.jar}=destfile=${sonar.jacoco.reportPath}
            </argLine>
          </b>
          <test>**/*.java</test>
        </configuration>
      </plugin>
[...]
    </plugins>
  </build>
[...]
</project>

但是我在声纳项目中没有看到 Administration/Branches & Pull Requests 下的 develop b运行ch。其实我在activity.

下并没有看到新的分析报告

想通了:问题是我用issues作为分析模式。正确的模式是发布。 命令行正确:

mvn sonar:sonar -Dsonar.organization=edemo -Dsonar.analysis.mode=publish -Dsonar.branch.name=develop

通过阅读找到解决方案:Can't publish results to Sonarqube server