summaryrefslogtreecommitdiffstats
path: root/cps-parent
diff options
context:
space:
mode:
authorClaudio David Gasparini <claudio.gasparini@pantheon.tech>2020-11-18 08:38:01 +0100
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>2020-11-19 07:57:50 +0000
commit87c74a1456c395d29f51f35b6e9a1f526114cef7 (patch)
treef53ec44af46eeffce686f10b5f632fd1e3393a21 /cps-parent
parent48830f146f6776afa180fefa101788b169bc841a (diff)
Introduce jacoco-maven-plugin
to enforce the minimum coverage Issue-ID: CPS-5 Signed-off-by: Claudio David Gasparini <claudio.gasparini@pantheon.tech> Change-Id: I7552fc65ab78e645c54af993840999e9818816b0
Diffstat (limited to 'cps-parent')
-rw-r--r--cps-parent/pom.xml72
1 files changed, 54 insertions, 18 deletions
diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml
index bd7e1a529..99f60951f 100644
--- a/cps-parent/pom.xml
+++ b/cps-parent/pom.xml
@@ -19,7 +19,9 @@
<app>org.onap.cps.Application</app>
<base.image>openjdk:11-jre-slim</base.image>
<java.version>11</java.version>
+ <jacoco-maven-plugin.version>0.8.6</jacoco-maven-plugin.version>
<jib-maven-plugin.version>2.6.0</jib-maven-plugin.version>
+ <minimum-coverage>0.15</minimum-coverage>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
<oparent.version>3.1.0</oparent.version>
@@ -177,6 +179,26 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>${jib-maven-plugin.version}</version>
+ <configuration>
+ <container>
+ <mainClass>${app}</mainClass>
+ <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
+ </container>
+ <from>
+ <image>${base.image}</image>
+ </from>
+ <to>
+ <image>${repository.name}</image>
+ <tags>
+ <tag>${tag.version}</tag>
+ </tags>
+ </to>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
@@ -240,6 +262,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
+ <argLine>@{argLine}</argLine>
<useFile>false</useFile>
<includes>
<include>**/*Spec.java</include>
@@ -248,24 +271,37 @@
</configuration>
</plugin>
<plugin>
- <groupId>com.google.cloud.tools</groupId>
- <artifactId>jib-maven-plugin</artifactId>
- <version>${jib-maven-plugin.version}</version>
- <configuration>
- <container>
- <mainClass>${app}</mainClass>
- <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
- </container>
- <from>
- <image>${base.image}</image>
- </from>
- <to>
- <image>${repository.name}</image>
- <tags>
- <tag>${tag.version}</tag>
- </tags>
- </to>
- </configuration>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>default-prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>coverage-check</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <rule>
+ <element>BUNDLE</element>
+ <limits>
+ <limit>
+ <counter>INSTRUCTION</counter>
+ <value>COVEREDRATIO</value>
+ <minimum>${minimum-coverage}</minimum>
+ </limit>
+ </limits>
+ </rule>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>