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