Use jacoco aggregate reports
[cps.git] / cps-parent / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5     <parent>
6         <groupId>org.onap.oparent</groupId>
7         <artifactId>oparent</artifactId>
8         <version>3.1.0</version>
9         <relativePath/>
10     </parent>
11     <modelVersion>4.0.0</modelVersion>
12
13     <groupId>org.onap.cps</groupId>
14     <artifactId>cps-parent</artifactId>
15     <version>0.0.1-SNAPSHOT</version>
16     <packaging>pom</packaging>
17
18     <properties>
19         <app>org.onap.cps.Application</app>
20         <base.image>openjdk:11-jre-slim</base.image>
21         <java.version>11</java.version>
22         <jib-maven-plugin.version>2.6.0</jib-maven-plugin.version>
23         <minimum-coverage>0.76</minimum-coverage>
24         <nexusproxy>https://nexus.onap.org</nexusproxy>
25         <oparent.version>3.1.0</oparent.version>
26         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
27         <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
28         <repository.name>nexus3.onap.org:10001/onap/cps-service</repository.name>
29         <spotbugs-maven-plugin.version>4.1.3</spotbugs-maven-plugin.version>
30         <spring-boot-maven-plugin.version>2.3.3.RELEASE</spring-boot-maven-plugin.version>
31         <spotbugs.slf4j.version>1.8.0-beta4</spotbugs.slf4j.version>
32         <spotbugs.bug-pattern.version>1.5.0</spotbugs.bug-pattern.version>
33         <spotbugs.version>4.2.0</spotbugs.version>
34         <swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
35         <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
36         <tag.version>${project.version}</tag.version>
37     </properties>
38
39     <distributionManagement>
40         <repository>
41             <id>ecomp-releases</id>
42             <name>ECOMP Release Repository</name>
43             <url>${nexusproxy}${releaseNexusPath}</url>
44         </repository>
45         <snapshotRepository>
46             <id>ecomp-snapshots</id>
47             <name>ECOMP Snapshot Repository</name>
48             <url>${nexusproxy}${snapshotNexusPath}</url>
49         </snapshotRepository>
50     </distributionManagement>
51
52     <profiles>
53         <profile>
54             <id>docker</id>
55             <activation>
56                 <activeByDefault>false</activeByDefault>
57             </activation>
58             <build>
59                 <pluginManagement>
60                     <plugins>
61                         <plugin>
62                             <groupId>com.google.cloud.tools</groupId>
63                             <artifactId>jib-maven-plugin</artifactId>
64                             <version>${jib-maven-plugin.version}</version>
65                             <configuration>
66                                 <container>
67                                     <mainClass>${app}</mainClass>
68                                     <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
69                                 </container>
70                                 <from>
71                                     <image>${base.image}</image>
72                                 </from>
73                                 <to>
74                                     <image>${repository.name}</image>
75                                     <tags>
76                                         <tag>${tag.version}</tag>
77                                     </tags>
78                                 </to>
79                             </configuration>
80                             <executions>
81                                 <execution>
82                                     <phase>package</phase>
83                                     <id>build</id>
84                                     <goals>
85                                         <goal>dockerBuild</goal>
86                                     </goals>
87                                 </execution>
88                                 <execution>
89                                     <phase>deploy</phase>
90                                     <id>buildAndPush</id>
91                                     <goals>
92                                         <goal>build</goal>
93                                     </goals>
94                                 </execution>
95                             </executions>
96                         </plugin>
97                     </plugins>
98                 </pluginManagement>
99             </build>
100         </profile>
101     </profiles>
102
103     <dependencyManagement>
104         <dependencies>
105             <dependency>
106                 <groupId>org.onap.cps</groupId>
107                 <artifactId>cps-dependencies</artifactId>
108                 <version>${project.version}</version>
109                 <type>pom</type>
110                 <scope>import</scope>
111             </dependency>
112             <dependency>
113                 <groupId>org.onap.cps</groupId>
114                 <artifactId>cps-bom</artifactId>
115                 <version>${project.version}</version>
116                 <type>pom</type>
117                 <scope>import</scope>
118             </dependency>
119         </dependencies>
120     </dependencyManagement>
121
122     <build>
123         <resources>
124             <resource>
125                 <directory>src/main/resources</directory>
126                 <filtering>true</filtering>
127             </resource>
128             <resource>
129                 <directory>target/generated-sources/license</directory>
130                 <includes>
131                     <include>third-party-licenses.txt</include>
132                 </includes>
133             </resource>
134             <resource>
135                 <directory>target/generated-resources/licenses</directory>
136                 <includes>
137                     <include>*.*</include>
138                 </includes>
139                 <targetPath>third-party-licenses</targetPath>
140             </resource>
141         </resources>
142         <pluginManagement>
143             <plugins>
144                 <plugin>
145                     <groupId>org.springframework.boot</groupId>
146                     <artifactId>spring-boot-maven-plugin</artifactId>
147                     <version>${spring-boot-maven-plugin.version}</version>
148                     <executions>
149                         <execution>
150                             <goals>
151                                 <goal>build-info</goal>
152                                 <goal>repackage</goal>
153                             </goals>
154                         </execution>
155                     </executions>
156                 </plugin>
157                 <!-- Swagger code generation. -->
158                 <plugin>
159                     <groupId>io.swagger.codegen.v3</groupId>
160                     <artifactId>swagger-codegen-maven-plugin</artifactId>
161                     <version>${swagger-codegen-maven-plugin.version}</version>
162                     <executions>
163                         <execution>
164                             <goals>
165                                 <goal>generate</goal>
166                             </goals>
167                             <configuration>
168                                 <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
169                                 <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
170                                 <modelPackage>org.onap.cps.rest.model</modelPackage>
171                                 <apiPackage>org.onap.cps.rest.api</apiPackage>
172                                 <language>spring</language>
173                                 <generateSupportingFiles>false</generateSupportingFiles>
174                                 <configOptions>
175                                     <sourceFolder>src/gen/java</sourceFolder>
176                                     <dateLibrary>java11</dateLibrary>
177                                     <interfaceOnly>true</interfaceOnly>
178                                     <useTags>true</useTags>
179                                 </configOptions>
180                             </configuration>
181                         </execution>
182                     </executions>
183                 </plugin>
184                 <plugin>
185                     <groupId>com.google.cloud.tools</groupId>
186                     <artifactId>jib-maven-plugin</artifactId>
187                     <version>${jib-maven-plugin.version}</version>
188                     <configuration>
189                         <container>
190                             <mainClass>${app}</mainClass>
191                             <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
192                         </container>
193                         <from>
194                             <image>${base.image}</image>
195                         </from>
196                         <to>
197                             <image>${repository.name}</image>
198                             <tags>
199                                 <tag>${tag.version}</tag>
200                             </tags>
201                         </to>
202                     </configuration>
203                 </plugin>
204                 <plugin>
205                     <groupId>com.github.spotbugs</groupId>
206                     <artifactId>spotbugs-maven-plugin</artifactId>
207                     <version>${spotbugs-maven-plugin.version}</version>
208                     <dependencies>
209                         <dependency>
210                             <groupId>com.github.spotbugs</groupId>
211                             <artifactId>spotbugs</artifactId>
212                             <version>${spotbugs.version}</version>
213                         </dependency>
214                         <dependency>
215                             <groupId>${project.groupId}</groupId>
216                             <artifactId>spotbugs</artifactId>
217                             <version>${project.version}</version>
218                         </dependency>
219                         <dependency>
220                             <!-- The SpotBugs Maven plugin uses SLF4J 1.8 beta 2 -->
221                             <groupId>org.slf4j</groupId>
222                             <artifactId>slf4j-simple</artifactId>
223                             <version>${spotbugs.slf4j.version}</version>
224                         </dependency>
225                     </dependencies>
226                     <configuration>
227                         <plugins>
228                             <plugin>
229                                 <groupId>jp.skypencil.findbugs.slf4j</groupId>
230                                 <artifactId>bug-pattern</artifactId>
231                                 <version>1.5.0</version>
232                             </plugin>
233                         </plugins>
234                         <!--
235                           Enables analysis which takes more memory but finds more bugs.
236                           If you run out of memory, changes the value of the effort element
237                           to 'Low'.
238                         -->
239                         <effort>Max</effort>
240                         <!-- Reports all bugs (other values are medium and max) -->
241                         <threshold>Low</threshold>
242                         <!-- Build doesn't fail if problems are found -->
243                         <failOnError>true</failOnError>
244                         <!-- References the excluded rules -->
245                         <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
246                         <!-- Produces XML report -->
247                         <xmlOutput>true</xmlOutput>
248                         <!-- Configures the directory in which the XML report is created -->
249                         <xmlOutputDirectory>${project.build.directory}/spotbugs</xmlOutputDirectory>
250                     </configuration>
251                     <executions>
252                         <!--
253                           Ensures that SpotBugs inspects source code when project is compiled.
254                         -->
255                         <execution>
256                             <id>analyze-compile</id>
257                             <phase>compile</phase>
258                             <goals>
259                                 <goal>check</goal>
260                             </goals>
261                         </execution>
262                     </executions>
263                 </plugin>
264             </plugins>
265         </pluginManagement>
266         <plugins>
267             <plugin>
268                 <groupId>org.apache.maven.plugins</groupId>
269                 <artifactId>maven-compiler-plugin</artifactId>
270                 <configuration>
271                     <source>${java.version}</source>
272                     <target>${java.version}</target>
273                 </configuration>
274             </plugin>
275             <plugin>
276                 <groupId>org.apache.maven.plugins</groupId>
277                 <artifactId>maven-checkstyle-plugin</artifactId>
278                 <executions>
279                     <execution>
280                         <id>onap-license</id>
281                         <goals>
282                             <goal>check</goal>
283                         </goals>
284                         <phase>process-sources</phase>
285                         <configuration>
286                             <configLocation>onap-checkstyle/check-license.xml</configLocation>
287                             <includeResources>false</includeResources>
288                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
289                             <includeTestResources>false</includeTestResources>
290                             <sourceDirectories>
291                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
292                             </sourceDirectories>
293                             <consoleOutput>false</consoleOutput>
294                             <violationSeverity>warning</violationSeverity>
295                             <failOnViolation>true</failOnViolation>
296                         </configuration>
297                     </execution>
298                     <execution>
299                         <id>onap-java-style</id>
300                         <goals>
301                             <goal>check</goal>
302                         </goals>
303                         <phase>process-sources</phase>
304                         <configuration>
305                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
306                             <sourceDirectories>
307                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
308                             </sourceDirectories>
309                             <includeResources>true</includeResources>
310                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
311                             <includeTestResources>true</includeTestResources>
312                             <consoleOutput>false</consoleOutput>
313                             <violationSeverity>warning</violationSeverity>
314                             <failOnViolation>true</failOnViolation>
315                         </configuration>
316                     </execution>
317                     <execution>
318                         <id>cps-java-style</id>
319                         <goals>
320                             <goal>check</goal>
321                         </goals>
322                         <phase>process-sources</phase>
323                         <configuration>
324                             <configLocation>cps-java-style.xml</configLocation>
325                             <sourceDirectories>
326                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
327                             </sourceDirectories>
328                             <includeResources>true</includeResources>
329                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
330                             <includeTestResources>true</includeTestResources>
331                             <consoleOutput>true</consoleOutput>
332                             <violationSeverity>warning</violationSeverity>
333                             <failOnViolation>true</failOnViolation>
334                         </configuration>
335                     </execution>
336                 </executions>
337                 <dependencies>
338                     <dependency>
339                         <groupId>org.onap.oparent</groupId>
340                         <artifactId>checkstyle</artifactId>
341                         <version>${oparent.version}</version>
342                     </dependency>
343                     <dependency>
344                         <groupId>${project.groupId}</groupId>
345                         <artifactId>checkstyle</artifactId>
346                         <version>${project.version}</version>
347                     </dependency>
348                 </dependencies>
349             </plugin>
350             <!-- Mandatory plugins for using Spock -->
351             <plugin>
352                 <!-- The gmavenplus plugin is used to compile Groovy code.
353                     To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
354                 <groupId>org.codehaus.gmavenplus</groupId>
355                 <artifactId>gmavenplus-plugin</artifactId>
356                 <version>1.9.0</version>
357                 <executions>
358                     <execution>
359                         <goals>
360                             <goal>compileTests</goal>
361                         </goals>
362                     </execution>
363                 </executions>
364             </plugin>
365             <!-- Required because names of spec classes don't match default
366                 Surefire patterns (`*Test` etc.) -->
367             <plugin>
368                 <groupId>org.apache.maven.plugins</groupId>
369                 <artifactId>maven-surefire-plugin</artifactId>
370                 <configuration>
371                     <!--suppress UnresolvedMavenProperty -->
372                     <argLine>${surefireArgLine}</argLine>
373                     <useFile>false</useFile>
374                     <includes>
375                         <include>**/*Spec.java</include>
376                         <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
377                     </includes>
378                     <excludes>
379                         <exclude>**/IT*.java</exclude>
380                     </excludes>
381                     <environmentVariables>
382                         <!--
383                             disable privileged container usage to cleanup the test containers;
384                             these will be removed automatically on jvm termination;
385                             see https://www.testcontainers.org/features/configuration/#disabling-ryuk
386                          -->
387                         <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
388                     </environmentVariables>
389                 </configuration>
390             </plugin>
391             <plugin>
392                 <groupId>org.jacoco</groupId>
393                 <artifactId>jacoco-maven-plugin</artifactId>
394                 <executions>
395                     <execution>
396                         <id>default-prepare-agent</id>
397                         <goals>
398                             <goal>prepare-agent</goal>
399                         </goals>
400                     </execution>
401                     <execution>
402                         <id>coverage-check</id>
403                         <goals>
404                             <goal>check</goal>
405                         </goals>
406                         <configuration>
407                             <excludes>
408                                 <exclude>org/onap/cps/rest/model/*</exclude>
409                             </excludes>
410                             <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
411                             <rules>
412                                 <rule>
413                                     <element>BUNDLE</element>
414                                     <limits>
415                                         <limit>
416                                             <counter>INSTRUCTION</counter>
417                                             <value>COVEREDRATIO</value>
418                                             <minimum>${minimum-coverage}</minimum>
419                                         </limit>
420                                     </limits>
421                                 </rule>
422                             </rules>
423                         </configuration>
424                     </execution>
425                     <execution>
426                         <id>report</id>
427                         <goals>
428                             <goal>report-aggregate</goal>
429                         </goals>
430                         <phase>verify</phase>
431                         <configuration>
432                             <dataFileIncludes>
433                                 <fileInclude>**/code-coverage/jacoco-ut.exec</fileInclude>
434                             </dataFileIncludes>
435                         </configuration>
436                     </execution>
437                 </executions>
438             </plugin>
439             <plugin>
440                 <groupId>com.github.spotbugs</groupId>
441                 <artifactId>spotbugs-maven-plugin</artifactId>
442             </plugin>
443             <plugin>
444                 <groupId>org.sonarsource.scanner.maven</groupId>
445                 <artifactId>sonar-maven-plugin</artifactId>
446             </plugin>
447         </plugins>
448     </build>
449 </project>