【发布时间】:2019-07-03 10:34:51
【问题描述】:
我尝试在声纳上设置拉取请求分析。我收到错误“服务器上不存在带有分支的拉取请求:开发”。根据Sonarqube Branch does not exist on server,可以使用 sonar.branch.name 属性创建一个新分支。
所以我跑了
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 下看到开发分支。实际上,我没有看到正在活动的新分析报告。
【问题讨论】: