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