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