summaryrefslogtreecommitdiffstats
path: root/cps-parent/pom.xml
blob: 6c4d1a3d62c2f9a311d8bdcf49fc5e18028f85e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ============LICENSE_START=======================================================
  Copyright (c) 2021 Pantheon.tech.
  Modifications Copyright (C) 2021 Bell Canada.
  Modifications Copyright (C) 2021-2024 Nordix Foundation.
  ================================================================================
  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.
  ============LICENSE_END=========================================================
-->

<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">

    <!-- Project Metadata -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.onap.cps</groupId>
    <artifactId>cps-parent</artifactId>
    <version>3.5.5-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <!-- Set UTF-8 encoding for consistent builds across platforms -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Application Configuration -->
        <app>org.onap.cps.Application</app>

        <!-- Parent Directory Configuration -->
        <parent.directory>${project.basedir}/..</parent.directory>

        <!-- Global properties for version management -->
        <bug.pattern.version>1.5.0</bug.pattern.version>
        <dependency.check.version>9.2.0</dependency.check.version>
        <git.commit.id.version>9.0.1</git.commit.id.version>
        <gmavenplus.plugin.version>4.0.1</gmavenplus.plugin.version>
        <jacoco.version>0.8.11</jacoco.version>
        <java.version>17</java.version>
        <jsonschema2pojo.maven.plugin.version>1.2.1</jsonschema2pojo.maven.plugin.version>
        <maven.checkstyle.plugin.version>3.3.1</maven.checkstyle.plugin.version>
        <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
        <maven.compiler.release>17</maven.compiler.release>
        <maven.failsafe.plugin.version>3.5.2</maven.failsafe.plugin.version>
        <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
        <maven.site.plugin.version>4.0.0-M13</maven.site.plugin.version>
        <maven.surefire.plugin.version>3.3.1</maven.surefire.plugin.version>
        <postgres.version>42.5.1</postgres.version>
        <slf4j.simple.version>2.0.6</slf4j.simple.version>
        <sonar.version>4.0.0.4121</sonar.version>
        <spotbugs.plugin.version>4.8.6.4</spotbugs.plugin.version>
        <spotbugs.version>4.8.6</spotbugs.version>
        <spring.boot.maven.plugin.version>3.3.1</spring.boot.maven.plugin.version>
        <swagger.codegen.version>1.2.1</swagger.codegen.version>

        <!-- Reporting paths and coverage -->
        <jacoco.execFile>${project.build.directory}/code-coverage/jacoco-ut.exec</jacoco.execFile>
        <jacoco.outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</jacoco.outputDirectory>
        <jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate>
        <minimum-coverage>1.00</minimum-coverage>
        <sonar.coverage.jacoco.xmlReportPaths>
            ../jacoco-report/target/site/jacoco-aggregate/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
    </properties>

    <!-- Dependency Management, Profiles, Build, and Plugins -->

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.onap.cps</groupId>
                <artifactId>cps-dependencies</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.onap.cps</groupId>
                <artifactId>cps-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>Windows</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <properties>
                <script.executor>python</script.executor>
            </properties>
        </profile>
        <profile>
            <id>unix</id>
            <activation>
                <os>
                    <family>unix</family>
                </os>
            </activation>
            <properties>
                <script.executor>python3</script.executor>
            </properties>
        </profile>
        <profile>
            <id>dependency-vulnerability-check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>${dependency.check.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>aggregate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- Performance tests are run with maven-failsafe-plugin using a separate profile, so they will
            not affect Jacoco coverage. Heap size is set here to ensure consistent test environment. -->
        <profile>
            <id>include-performance</id>
            <properties>
                <failsafeArgLine>-Xms512m -Xmx512m</failsafeArgLine>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven.failsafe.plugin.version}</version>
                        <configuration>
                            <includes>
                                <include>**/*PerfTest.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>target/generated-sources/license</directory>
                <includes>
                    <include>third-party-licenses.txt</include>
                </includes>
            </resource>
            <resource>
                <directory>target/generated-resources/licenses</directory>
                <includes>
                    <include>*.*</include>
                </includes>
                <targetPath>third-party-licenses</targetPath>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring.boot.maven.plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>io.github.git-commit-id</groupId>
                    <artifactId>git-commit-id-maven-plugin</artifactId>
                    <version>${git.commit.id.version}</version>
                    <executions>
                        <execution>
                            <id>get-git-info</id>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                            <phase>package</phase>
                        </execution>
                    </executions>
                </plugin>
                <!-- Swagger code generation. -->
                <plugin>
                    <groupId>io.swagger.codegen.v3</groupId>
                    <artifactId>swagger-codegen-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>openapi-yaml-gen</id>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <phase>compile</phase>
                            <configuration>
                                <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec>
                                <language>openapi-yaml</language>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${spotbugs.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs</artifactId>
                            <version>${spotbugs.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>spotbugs</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                        <dependency>
                            <!-- The SpotBugs Maven plugin uses SLF4J 1.8 beta 2 -->
                            <groupId>org.slf4j</groupId>
                            <artifactId>slf4j-simple</artifactId>
                            <version>${slf4j.simple.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <plugins>
                            <plugin>
                                <groupId>jp.skypencil.findbugs.slf4j</groupId>
                                <artifactId>bug-pattern</artifactId>
                                <version>${bug.pattern.version}</version>
                            </plugin>
                        </plugins>
                        <!--
                          Enables analysis which takes more memory but finds more bugs.
                          If you run out of memory, changes the value of the effort element
                          to 'Low'.
                        -->
                        <addSourceDirs>true</addSourceDirs>
                        <effort>Max</effort>
                        <!-- Reports all bugs (other values are medium and max) -->
                        <threshold>Low</threshold>
                        <!-- Build doesn't fail if problems are found -->
                        <failOnError>true</failOnError>
                        <!-- References the excluded rules -->
                        <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
                        <!-- Produces XML report -->
                        <xmlOutput>true</xmlOutput>
                        <!-- Configures the directory in which the XML report is created -->
                        <xmlOutputDirectory>${project.build.directory}/spotbugs</xmlOutputDirectory>
                    </configuration>
                    <executions>
                        <!--
                          Ensures that SpotBugs inspects source code when project is compiled.
                        -->
                        <execution>
                            <id>analyze-compile</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jsonschema2pojo</groupId>
                    <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                    <version>${jsonschema2pojo.maven.plugin.version}</version>
                    <configuration>
                        <targetVersion>${java.version}</targetVersion>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven.checkstyle.plugin.version}</version>
                <executions>
                    <execution>
                        <id>onap-license</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>process-sources</phase>
                        <configuration>
                            <configLocation>cps-checkstyle/check-license.xml</configLocation>
                            <includeResources>false</includeResources>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <includeTestResources>false</includeTestResources>
                            <sourceDirectories>
                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                            </sourceDirectories>
                            <consoleOutput>false</consoleOutput>
                            <violationSeverity>warning</violationSeverity>
                            <failOnViolation>true</failOnViolation>
                        </configuration>
                    </execution>
                    <execution>
                        <id>cps-java-style</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>process-sources</phase>
                        <configuration>
                            <configLocation>cps-checkstyle/cps-java-style.xml</configLocation>
                            <sourceDirectories>
                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                            </sourceDirectories>
                            <includeResources>true</includeResources>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <includeTestResources>true</includeTestResources>
                            <consoleOutput>false</consoleOutput>
                            <violationSeverity>warning</violationSeverity>
                            <failOnViolation>true</failOnViolation>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!-- Mandatory plugins for using Spock -->
            <plugin>
                <!-- The gmavenplus plugin is used to compile Groovy code.
                    To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>${gmavenplus.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compileTests</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Required because names of spec classes don't match default
                Surefire patterns (`*Test` etc.) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <!--suppress UnresolvedMavenProperty -->
                    <argLine>${surefireArgLine}</argLine>
                    <useFile>false</useFile>
                    <includes>
                        <include>**/*Spec.java</include>
                        <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
                    </includes>
                    <excludes>
                        <!-- maven-failsafe-plugin will run performance tests in the integration-test module,
                             so performance tests will not affect Jacoco coverage (jacoco-report module is configured
                             to aggregate results from tests run with maven-surefire-plugin only) -->
                        <exclude>**/*PerfTest.java</exclude>
                    </excludes>
                    <environmentVariables>
                        <!--
                            disable privileged container usage to cleanup the test containers;
                            these will be removed automatically on jvm termination;
                            see https://www.testcontainers.org/features/configuration/#disabling-ryuk
                         -->
                        <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
                        <TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX>${docker.pull.registry}/</TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX>
                    </environmentVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <!-- Exclude all generated classes or specific patterns if necessary -->
                    <excludes>
                        <exclude>org/onap/cps/events/model/*</exclude>
                        <exclude>org/onap/cps/rest/model/*</exclude>
                        <exclude>org/onap/cps/cpspath/parser/antlr4/*</exclude>
                        <exclude>org/onap/cps/ncmp/rest/model/*</exclude>
                        <exclude>org/onap/cps/**/*MapperImpl.class</exclude>
                        <exclude>org/onap/cps/ncmp/rest/stub/*</exclude>
                        <exclude>org/onap/cps/policyexecutor/stub/model/*</exclude>
                        <exclude>**/pom.xml</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${jacoco.execFile}</destFile>
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>coverage-check</id>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <dataFile>${jacoco.execFile}</dataFile>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${minimum-coverage}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${jacoco.execFile}</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${jacoco.outputDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Sonar Plugin for Code Quality -->
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>${sonar.version}</version>
            </plugin>

            <!-- Maven Site Plugin for Site Generation -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven.site.plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-site</id>
                        <phase>site</phase>
                        <goals><goal>site</goal></goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>