0

we have use sonar/jacoco for our code coverage, and one it stopped working, and the error message is:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project prism-parent-pom: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:3.2' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 52.0

After some painful comparison of before and after logs, I found out the sonar-maven-plugin change from version 3.0.2 to 3.2, even though there is no change to the pom file.

I also run 'mvn dependency:tree' and don't see any dependency of sonar.

Last i updated the pom to specify the sonar-maven-plugin version to enforce it to use the version that used to work, but it still doesn't help, here is my parent pom

<profiles>
  <profile>
      <id>coverage-per-test</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>3.0.2</version>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.4.201502262128</version>
            <executions>
              <execution>
                <id>default-prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>default-prepare-agent-integration</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>prepare-agent-integration</goal>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <properties>
                <property>
                  <name>listener</name>
                  <value>org.sonar.java.jacoco.JUnitListener</value>
                </property>
              </properties>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <properties>
                <property>
                  <name>listener</name>
                  <value>org.sonar.java.jacoco.JUnitListener</value>
                </property>
              </properties>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.sonar-plugins.java</groupId>
          <artifactId>sonar-jacoco-listeners</artifactId>
          <version>2.7</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    </profiles>

is there anything wrong in my pom?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user468587
  • 4,799
  • 24
  • 67
  • 124

1 Answers1

3

In Java cause of

Unsupported major.minor version 52.0

is that version of used JVM is lower than version for which class files were compiled. "52.0" refers to Java 8 and this version is indeed required starting from SonarQube version 5.6. All in all, I'm pretty sure that SonarQube server has been upgraded, while you use Java lower than 8.

Godin
  • 9,801
  • 2
  • 39
  • 76