Getting the error "The string must be zero or greater than zero (received 0)" during sonar assembly using jacoco

I updated my java plugin for sonar to 3.7. We use the built-in jacoco plugin to cover the code. We use maven target org.jacoco: jacoco-maven-plugin: prepare-agent and sonar: sonar to get the sonar assembly called by jenkins. However, after updating, I get the following error:

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

The following is the plugin data installed with my version of SonarQube version 5.1.2:

  • Java 3.7
  • LDAP 1.3
  • Git 1
  • SVN 1
  • Cobertura 1.6.3

We do not use cobertur. Instead of using inline jacoco as above.

We use sonar-maven-plugin: 2.7.1.

+4

Source: https://habr.com/ru/post/1614725/


All Articles