1

Im trying to setup everything so I could run a code coverage on maven and after creating a report with it I wanted to view the results on sonarQube dashboard.

Im a complete newbie on those tools so I was trying to research and managed to get some tutorials to get things running. SonarQube is working fine although code coverage is not.

(the code is mostly in php with some css, etc...)

Im Using: Apache Maven 3.6.0, SonarQube 7.5, PHP 7.3.1, jacoco 0.8.3, coverage.
(I think thats all)

My POM file:

<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">

<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion> 
<groupId>com.mytutorial</groupId>
<artifactId>simpleSpringRestWeb</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>simpleSpringRestWeb</name>
<url>http://maven.apache.org</url>

<properties>
    <javac.src.version>1.7</javac.src.version>
    <javac.target.version>1.7</javac.target.version>
    <test.coverage.rate>100</test.coverage.rate>
    <cobertura.skip>false</cobertura.skip>
    <cobertura.skip>false</cobertura.skip>
</properties> 
 <dependencies>
 <dependency>
     <groupId>net.sourceforge.cobertura</groupId>
     <artifactId>cobertura</artifactId>
      <version>2.1.1</version>
      <scope>test</scope>
 </dependency>
 <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.7</version>
        <scope>test</scope>
</dependency>
</dependencies> 
<reporting>
<plugins>
      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
            </configuration>
      </plugin>
      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.2.2</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <version>3.0.0-M3</version>
        </plugin>
        <plugin> 
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>3.7.1</version>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <formats>
                    <format>xml</format>
                    <format>html</format>
                </formats>
            </configuration>
         <reportSets>
            <reportSet>
                <id>cobertura-report</id>
                <reports>
                    <report>clean</report>
                    <report>cobertura</report>
                </reports>
            </reportSet>
        </reportSets> 
        </plugin>
    </plugins>

sonar-project.properties:
-Dproject.settings=./sonar-project.properties
sonar.cobertura.reportPaths=C:/simple-maven-project-with-tests-master/target/surefire-reports

using mvn install results in Build Failure
mvn install output1 mvn install output2

using mvn clean package results in Build Failure
mvn clean package output1 mvn clean package output2

used someone tip (link below) mvn -Dmaven.test.skip=true your-plugin:your-goal output result

How to run a maven goal when there is tests failures?


I already searched everywhere I could, managed to fix some problems but this one... not at all. I have been tryng to get a solution for days now and at this point Im too confused and dont know what else I can do.

Sorry for the long post and please notice me if I didnt give any important information.

Regards!

Lasion
  • 11
  • 4

0 Answers0