Skip to content

Commit

Permalink
Add new maven module to build an aggregate jacoco test coverage XML f…
Browse files Browse the repository at this point in the history
…ile and use this XML file on sonarcloud to fix 0% test coverage
  • Loading branch information
steinarb committed Feb 23, 2020
1 parent d00fbd7 commit c17d799
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ addons:
organization: steinarb-github
token: $SONAR_TOKEN
script:
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar
- mvn cobertura:cobertura coveralls:report
66 changes: 66 additions & 0 deletions jacoco-coverage-report/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- Copyright 2019 Steinar Bang -->
<!-- -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- you may not use this file except in compliance with the License. -->
<!-- You may obtain a copy of the License at -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- Unless required by applicable law or agreed to in writing, -->
<!-- software distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- See the License for the specific language governing permissions and limitations -->
<!-- under the License. -->

<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" xml:space="preserve">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>no.priv.bang.demos.jerseyinkaraf</groupId>
<artifactId>jerseyinkaraf</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>jacoco-coverage-report</artifactId>

<name>Jacoco aggregate XML test coverage report</name>

<dependencies>
<dependency>
<groupId>no.priv.bang.demos.jerseyinkaraf</groupId>
<artifactId>jerseyinkaraf.servicedef</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<artifactId>jerseyinkaraf.services</artifactId>
<groupId>no.priv.bang.demos.jerseyinkaraf</groupId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>no.priv.bang.demos.jerseyinkaraf</groupId>
<artifactId>jerseyinkaraf.webapi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>no.priv.bang.demos.jerseyinkaraf</groupId>
<artifactId>jerseyinkaraf.webgui</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report</id>
<goals>
<goal>report-aggregate</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../jacoco-coverage-report/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<karaf-feature-name>${project.artifactId}</karaf-feature-name>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<maven.bundle.plugin.version>4.2.0</maven.bundle.plugin.version>
Expand All @@ -44,6 +45,7 @@
<module>jerseyinkaraf.services</module>
<module>jerseyinkaraf.webgui</module>
<module>jerseyinkaraf.webapi</module>
<module>jacoco-coverage-report</module>
</modules>

<dependencies>
Expand Down Expand Up @@ -235,6 +237,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down

0 comments on commit c17d799

Please sign in to comment.