Persistence layer testing incl CpsModulePersistenceService testing
[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.20</minimum-coverage>
24         <nexusproxy>https://nexus.onap.org</nexusproxy>
25         <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
26         <oparent.version>3.1.0</oparent.version>
27         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
28         <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
29         <repository.name>nexus3.onap.org:10001/onap/cps-service</repository.name>
30         <spring-boot-maven-plugin.version>2.3.3.RELEASE</spring-boot-maven-plugin.version>
31         <swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
32         <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
33         <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
34         <tag.version>${project.version}</tag.version>
35     </properties>
36
37     <distributionManagement>
38         <repository>
39             <id>ecomp-releases</id>
40             <name>ECOMP Release Repository</name>
41             <url>${nexusproxy}${releaseNexusPath}</url>
42         </repository>
43         <snapshotRepository>
44             <id>ecomp-snapshots</id>
45             <name>ECOMP Snapshot Repository</name>
46             <url>${nexusproxy}${snapshotNexusPath}</url>
47         </snapshotRepository>
48     </distributionManagement>
49
50     <profiles>
51         <profile>
52             <id>docker</id>
53             <activation>
54                 <activeByDefault>false</activeByDefault>
55             </activation>
56             <build>
57                 <pluginManagement>
58                     <plugins>
59                         <plugin>
60                             <groupId>com.google.cloud.tools</groupId>
61                             <artifactId>jib-maven-plugin</artifactId>
62                             <version>${jib-maven-plugin.version}</version>
63                             <configuration>
64                                 <container>
65                                     <mainClass>${app}</mainClass>
66                                     <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
67                                 </container>
68                                 <from>
69                                     <image>${base.image}</image>
70                                 </from>
71                                 <to>
72                                     <image>${repository.name}</image>
73                                     <tags>
74                                         <tag>${tag.version}</tag>
75                                     </tags>
76                                 </to>
77                             </configuration>
78                             <executions>
79                                 <execution>
80                                     <phase>package</phase>
81                                     <id>build</id>
82                                     <goals>
83                                         <goal>dockerBuild</goal>
84                                     </goals>
85                                 </execution>
86                                 <execution>
87                                     <phase>deploy</phase>
88                                     <id>buildAndPush</id>
89                                     <goals>
90                                         <goal>build</goal>
91                                     </goals>
92                                 </execution>
93                             </executions>
94                         </plugin>
95                     </plugins>
96                 </pluginManagement>
97             </build>
98         </profile>
99         <profile>
100             <id>skip-db-tests</id>
101             <activation>
102                 <!-- exclude module tests by default till Jenkins is configured to support test containers -->
103                 <activeByDefault>true</activeByDefault>
104             </activation>
105             <build>
106                 <plugins>
107                     <plugin>
108                         <groupId>org.apache.maven.plugins</groupId>
109                         <artifactId>maven-surefire-plugin</artifactId>
110                         <configuration>
111                             <excludes>
112                                 <exclude>**/spi/impl/*Test.java</exclude>
113                             </excludes>
114                         </configuration>
115                     </plugin>
116                 </plugins>
117             </build>
118         </profile>
119     </profiles>
120
121     <dependencyManagement>
122         <dependencies>
123             <dependency>
124                 <groupId>org.onap.cps</groupId>
125                 <artifactId>cps-dependencies</artifactId>
126                 <version>${project.version}</version>
127                 <type>pom</type>
128                 <scope>import</scope>
129             </dependency>
130             <dependency>
131                 <groupId>org.onap.cps</groupId>
132                 <artifactId>cps-bom</artifactId>
133                 <version>${project.version}</version>
134                 <type>pom</type>
135                 <scope>import</scope>
136             </dependency>
137         </dependencies>
138     </dependencyManagement>
139
140     <build>
141         <resources>
142             <resource>
143                 <directory>src/main/resources</directory>
144                 <filtering>true</filtering>
145             </resource>
146             <resource>
147                 <directory>target/generated-sources/license</directory>
148                 <includes>
149                     <include>third-party-licenses.txt</include>
150                 </includes>
151             </resource>
152             <resource>
153                 <directory>target/generated-resources/licenses</directory>
154                 <includes>
155                     <include>*.*</include>
156                 </includes>
157                 <targetPath>third-party-licenses</targetPath>
158             </resource>
159         </resources>
160         <pluginManagement>
161             <plugins>
162                 <plugin>
163                     <groupId>org.springframework.boot</groupId>
164                     <artifactId>spring-boot-maven-plugin</artifactId>
165                     <version>${spring-boot-maven-plugin.version}</version>
166                     <executions>
167                         <execution>
168                             <goals>
169                                 <goal>build-info</goal>
170                                 <goal>repackage</goal>
171                             </goals>
172                         </execution>
173                     </executions>
174                 </plugin>
175                 <!-- Swagger code generation. -->
176                 <plugin>
177                     <groupId>io.swagger.codegen.v3</groupId>
178                     <artifactId>swagger-codegen-maven-plugin</artifactId>
179                     <version>${swagger-codegen-maven-plugin.version}</version>
180                     <executions>
181                         <execution>
182                             <goals>
183                                 <goal>generate</goal>
184                             </goals>
185                             <configuration>
186                                 <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
187                                 <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
188                                 <modelPackage>org.onap.cps.rest.model</modelPackage>
189                                 <apiPackage>org.onap.cps.rest.api</apiPackage>
190                                 <language>spring</language>
191                                 <generateSupportingFiles>false</generateSupportingFiles>
192                                 <configOptions>
193                                     <sourceFolder>src/gen/java</sourceFolder>
194                                     <dateLibrary>java11</dateLibrary>
195                                     <interfaceOnly>true</interfaceOnly>
196                                     <useTags>true</useTags>
197                                 </configOptions>
198                             </configuration>
199                         </execution>
200                     </executions>
201                 </plugin>
202                 <plugin>
203                     <groupId>com.google.cloud.tools</groupId>
204                     <artifactId>jib-maven-plugin</artifactId>
205                     <version>${jib-maven-plugin.version}</version>
206                     <configuration>
207                         <container>
208                             <mainClass>${app}</mainClass>
209                             <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
210                         </container>
211                         <from>
212                             <image>${base.image}</image>
213                         </from>
214                         <to>
215                             <image>${repository.name}</image>
216                             <tags>
217                                 <tag>${tag.version}</tag>
218                             </tags>
219                         </to>
220                     </configuration>
221                 </plugin>
222             </plugins>
223         </pluginManagement>
224         <plugins>
225             <plugin>
226                 <groupId>org.apache.maven.plugins</groupId>
227                 <artifactId>maven-compiler-plugin</artifactId>
228                 <configuration>
229                     <source>${java.version}</source>
230                     <target>${java.version}</target>
231                 </configuration>
232             </plugin>
233             <plugin>
234                 <groupId>org.apache.maven.plugins</groupId>
235                 <artifactId>maven-checkstyle-plugin</artifactId>
236                 <executions>
237                     <execution>
238                         <id>onap-license</id>
239                         <goals>
240                             <goal>check</goal>
241                         </goals>
242                         <phase>process-sources</phase>
243                         <configuration>
244                             <configLocation>onap-checkstyle/check-license.xml</configLocation>
245                             <includeResources>false</includeResources>
246                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
247                             <includeTestResources>false</includeTestResources>
248                             <sourceDirectories>
249                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
250                             </sourceDirectories>
251                             <consoleOutput>false</consoleOutput>
252                             <violationSeverity>warning</violationSeverity>
253                             <failOnViolation>true</failOnViolation>
254                         </configuration>
255                     </execution>
256                     <execution>
257                         <id>onap-java-style</id>
258                         <goals>
259                             <goal>check</goal>
260                         </goals>
261                         <phase>process-sources</phase>
262                         <configuration>
263                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
264                             <sourceDirectories>
265                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
266                             </sourceDirectories>
267                             <includeResources>true</includeResources>
268                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
269                             <includeTestResources>true</includeTestResources>
270                             <consoleOutput>false</consoleOutput>
271                             <violationSeverity>warning</violationSeverity>
272                             <failOnViolation>true</failOnViolation>
273                         </configuration>
274                     </execution>
275                     <execution>
276                         <id>cps-java-style</id>
277                         <goals>
278                             <goal>check</goal>
279                         </goals>
280                         <phase>process-sources</phase>
281                         <configuration>
282                             <configLocation>cps-java-style.xml</configLocation>
283                             <sourceDirectories>
284                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
285                             </sourceDirectories>
286                             <includeResources>true</includeResources>
287                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
288                             <includeTestResources>true</includeTestResources>
289                             <consoleOutput>true</consoleOutput>
290                             <violationSeverity>warning</violationSeverity>
291                             <failOnViolation>true</failOnViolation>
292                         </configuration>
293                     </execution>
294                 </executions>
295                 <dependencies>
296                     <dependency>
297                         <groupId>org.onap.oparent</groupId>
298                         <artifactId>checkstyle</artifactId>
299                         <version>${oparent.version}</version>
300                     </dependency>
301                     <dependency>
302                         <groupId>${project.groupId}</groupId>
303                         <artifactId>checkstyle</artifactId>
304                         <version>${project.version}</version>
305                     </dependency>
306                 </dependencies>
307             </plugin>
308             <!-- Mandatory plugins for using Spock -->
309             <plugin>
310                 <!-- The gmavenplus plugin is used to compile Groovy code.
311                     To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
312                 <groupId>org.codehaus.gmavenplus</groupId>
313                 <artifactId>gmavenplus-plugin</artifactId>
314                 <version>1.9.0</version>
315                 <executions>
316                     <execution>
317                         <goals>
318                             <goal>compileTests</goal>
319                         </goals>
320                     </execution>
321                 </executions>
322             </plugin>
323             <!-- Required because names of spec classes don't match default
324                 Surefire patterns (`*Test` etc.) -->
325             <plugin>
326                 <groupId>org.apache.maven.plugins</groupId>
327                 <artifactId>maven-surefire-plugin</artifactId>
328                 <configuration>
329                     <argLine>${surefireArgLine}</argLine>
330                     <useFile>false</useFile>
331                     <includes>
332                         <include>**/*Spec.java</include>
333                         <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
334                     </includes>
335                     <excludes>
336                         <exclude>**/IT*.java</exclude>
337                     </excludes>
338                 </configuration>
339             </plugin>
340             <plugin>
341                 <groupId>org.jacoco</groupId>
342                 <artifactId>jacoco-maven-plugin</artifactId>
343                 <executions>
344                     <execution>
345                         <id>default-prepare-agent</id>
346                         <goals>
347                             <goal>prepare-agent</goal>
348                         </goals>
349                     </execution>
350                     <execution>
351                         <id>coverage-check</id>
352                         <goals>
353                             <goal>check</goal>
354                         </goals>
355                         <configuration>
356                             <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
357                             <rules>
358                                 <rule>
359                                     <element>BUNDLE</element>
360                                     <limits>
361                                         <limit>
362                                             <counter>INSTRUCTION</counter>
363                                             <value>COVEREDRATIO</value>
364                                             <minimum>${minimum-coverage}</minimum>
365                                         </limit>
366                                     </limits>
367                                 </rule>
368                             </rules>
369                         </configuration>
370                     </execution>
371                 </executions>
372             </plugin>
373         </plugins>
374     </build>
375 </project>