4

我已将我的声纳 java 插件升级到 3.7。我们使用内置的 jacoco 插件来进行代码覆盖。我们使用 maven 目标 org.jacoco:jacoco-maven-plugin:prepare-agent 和 sonar:sonar 来获取由 jenkins 作业触发的声纳构建。但是发布升级后我收到以下错误:

Caused by: java.lang.IllegalArgumentException: Line must be null or greater than zero (got 0)
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
    at org.sonar.api.issue.internal.DefaultIssue.setLine(DefaultIssue.java:251)
    at org.sonar.core.issue.DefaultIssueBuilder.build(DefaultIssueBuilder.java:127)
    at org.sonar.core.issue.DefaultIssueBuilder.build(DefaultIssueBuilder.java:34)
    at org.sonar.java.SonarComponents.addIssue(SonarComponents.java:207)
    at org.sonar.java.bytecode.visitor.DefaultBytecodeContext.reportIssue(DefaultBytecodeContext.java:59)
    at org.sonar.java.checks.UnusedPrivateMethodCheck.visitMethod(UnusedPrivateMethodCheck.java:74)
    at org.sonar.java.bytecode.BytecodeVisitorNotifier.callVisitMethod(BytecodeVisitorNotifier.java:68)
    at org.sonar.java.bytecode.BytecodeVisitorNotifier.callVisitMethodAndFieldAndEdge(BytecodeVisitorNotifier.java:49)
    at org.sonar.java.bytecode.BytecodeVisitorNotifier.notifyVisitors(BytecodeVisitorNotifier.java:42)
    at org.sonar.java.bytecode.BytecodeScanner.notifyBytecodeVisitors(BytecodeScanner.java:80)
    ... 57 more

以下是我的 SonarQube 5.1.2 版安装的插件详细信息:

  • Java 3.7
  • LDAP 1.3
  • 吉特 1
  • SVN 1
  • Cobertura 1.6.3

我们没有使用 cobertura。而是使用上面提到的内置 jacoco。

我们正在使用 sonar-maven-plugin:2.7.1。

4

0 回答 0