Solve issue with Sonar Job coverage jobs
[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     </profiles>
100
101     <dependencyManagement>
102         <dependencies>
103             <dependency>
104                 <groupId>org.onap.cps</groupId>
105                 <artifactId>cps-dependencies</artifactId>
106                 <version>${project.version}</version>
107                 <type>pom</type>
108                 <scope>import</scope>
109             </dependency>
110             <dependency>
111                 <groupId>org.onap.cps</groupId>
112                 <artifactId>cps-bom</artifactId>
113                 <version>${project.version}</version>
114                 <type>pom</type>
115                 <scope>import</scope>
116             </dependency>
117         </dependencies>
118     </dependencyManagement>
119
120     <build>
121         <resources>
122             <resource>
123                 <directory>src/main/resources</directory>
124                 <filtering>true</filtering>
125             </resource>
126             <resource>
127                 <directory>target/generated-sources/license</directory>
128                 <includes>
129                     <include>third-party-licenses.txt</include>
130                 </includes>
131             </resource>
132             <resource>
133                 <directory>target/generated-resources/licenses</directory>
134                 <includes>
135                     <include>*.*</include>
136                 </includes>
137                 <targetPath>third-party-licenses</targetPath>
138             </resource>
139         </resources>
140         <pluginManagement>
141             <plugins>
142                 <plugin>
143                     <groupId>org.springframework.boot</groupId>
144                     <artifactId>spring-boot-maven-plugin</artifactId>
145                     <version>${spring-boot-maven-plugin.version}</version>
146                     <executions>
147                         <execution>
148                             <goals>
149                                 <goal>build-info</goal>
150                                 <goal>repackage</goal>
151                             </goals>
152                         </execution>
153                     </executions>
154                 </plugin>
155                 <!-- Swagger code generation. -->
156                 <plugin>
157                     <groupId>io.swagger.codegen.v3</groupId>
158                     <artifactId>swagger-codegen-maven-plugin</artifactId>
159                     <version>${swagger-codegen-maven-plugin.version}</version>
160                     <executions>
161                         <execution>
162                             <goals>
163                                 <goal>generate</goal>
164                             </goals>
165                             <configuration>
166                                 <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
167                                 <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
168                                 <modelPackage>org.onap.cps.rest.model</modelPackage>
169                                 <apiPackage>org.onap.cps.rest.api</apiPackage>
170                                 <language>spring</language>
171                                 <generateSupportingFiles>false</generateSupportingFiles>
172                                 <configOptions>
173                                     <sourceFolder>src/gen/java</sourceFolder>
174                                     <dateLibrary>java11</dateLibrary>
175                                     <interfaceOnly>true</interfaceOnly>
176                                     <useTags>true</useTags>
177                                 </configOptions>
178                             </configuration>
179                         </execution>
180                     </executions>
181                 </plugin>
182                 <plugin>
183                     <groupId>com.google.cloud.tools</groupId>
184                     <artifactId>jib-maven-plugin</artifactId>
185                     <version>${jib-maven-plugin.version}</version>
186                     <configuration>
187                         <container>
188                             <mainClass>${app}</mainClass>
189                             <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
190                         </container>
191                         <from>
192                             <image>${base.image}</image>
193                         </from>
194                         <to>
195                             <image>${repository.name}</image>
196                             <tags>
197                                 <tag>${tag.version}</tag>
198                             </tags>
199                         </to>
200                     </configuration>
201                 </plugin>
202             </plugins>
203         </pluginManagement>
204         <plugins>
205             <plugin>
206                 <groupId>org.apache.maven.plugins</groupId>
207                 <artifactId>maven-compiler-plugin</artifactId>
208                 <configuration>
209                     <source>${java.version}</source>
210                     <target>${java.version}</target>
211                 </configuration>
212             </plugin>
213             <plugin>
214                 <groupId>org.apache.maven.plugins</groupId>
215                 <artifactId>maven-checkstyle-plugin</artifactId>
216                 <executions>
217                     <execution>
218                         <id>onap-license</id>
219                         <goals>
220                             <goal>check</goal>
221                         </goals>
222                         <phase>process-sources</phase>
223                         <configuration>
224                             <configLocation>onap-checkstyle/check-license.xml</configLocation>
225                             <includeResources>false</includeResources>
226                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
227                             <includeTestResources>false</includeTestResources>
228                             <sourceDirectories>
229                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
230                             </sourceDirectories>
231                             <consoleOutput>false</consoleOutput>
232                             <violationSeverity>warning</violationSeverity>
233                             <failOnViolation>true</failOnViolation>
234                         </configuration>
235                     </execution>
236                     <execution>
237                         <id>onap-java-style</id>
238                         <goals>
239                             <goal>check</goal>
240                         </goals>
241                         <phase>process-sources</phase>
242                         <configuration>
243                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
244                             <sourceDirectories>
245                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
246                             </sourceDirectories>
247                             <includeResources>true</includeResources>
248                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
249                             <includeTestResources>true</includeTestResources>
250                             <consoleOutput>false</consoleOutput>
251                             <violationSeverity>warning</violationSeverity>
252                             <failOnViolation>true</failOnViolation>
253                         </configuration>
254                     </execution>
255                     <execution>
256                         <id>cps-java-style</id>
257                         <goals>
258                             <goal>check</goal>
259                         </goals>
260                         <phase>process-sources</phase>
261                         <configuration>
262                             <configLocation>cps-java-style.xml</configLocation>
263                             <sourceDirectories>
264                                 <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
265                             </sourceDirectories>
266                             <includeResources>true</includeResources>
267                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
268                             <includeTestResources>true</includeTestResources>
269                             <consoleOutput>true</consoleOutput>
270                             <violationSeverity>warning</violationSeverity>
271                             <failOnViolation>true</failOnViolation>
272                         </configuration>
273                     </execution>
274                 </executions>
275                 <dependencies>
276                     <dependency>
277                         <groupId>org.onap.oparent</groupId>
278                         <artifactId>checkstyle</artifactId>
279                         <version>${oparent.version}</version>
280                     </dependency>
281                     <dependency>
282                         <groupId>${project.groupId}</groupId>
283                         <artifactId>checkstyle</artifactId>
284                         <version>${project.version}</version>
285                     </dependency>
286                 </dependencies>
287             </plugin>
288             <!-- Mandatory plugins for using Spock -->
289             <plugin>
290                 <!-- The gmavenplus plugin is used to compile Groovy code.
291                     To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
292                 <groupId>org.codehaus.gmavenplus</groupId>
293                 <artifactId>gmavenplus-plugin</artifactId>
294                 <version>1.9.0</version>
295                 <executions>
296                     <execution>
297                         <goals>
298                             <goal>compileTests</goal>
299                         </goals>
300                     </execution>
301                 </executions>
302             </plugin>
303             <!-- Required because names of spec classes don't match default
304                 Surefire patterns (`*Test` etc.) -->
305             <plugin>
306                 <groupId>org.apache.maven.plugins</groupId>
307                 <artifactId>maven-surefire-plugin</artifactId>
308                 <configuration>
309                     <argLine>${surefireArgLine}</argLine>
310                     <useFile>false</useFile>
311                     <includes>
312                         <include>**/*Spec.java</include>
313                         <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
314                     </includes>
315                     <excludes>
316                         <exclude>**/IT*.java</exclude>
317                     </excludes>
318                 </configuration>
319             </plugin>
320             <plugin>
321                 <groupId>org.jacoco</groupId>
322                 <artifactId>jacoco-maven-plugin</artifactId>
323                 <executions>
324                     <execution>
325                         <id>default-prepare-agent</id>
326                         <goals>
327                             <goal>prepare-agent</goal>
328                         </goals>
329                     </execution>
330                     <execution>
331                         <id>coverage-check</id>
332                         <goals>
333                             <goal>check</goal>
334                         </goals>
335                         <configuration>
336                             <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
337                             <rules>
338                                 <rule>
339                                     <element>BUNDLE</element>
340                                     <limits>
341                                         <limit>
342                                             <counter>INSTRUCTION</counter>
343                                             <value>COVEREDRATIO</value>
344                                             <minimum>${minimum-coverage}</minimum>
345                                         </limit>
346                                     </limits>
347                                 </rule>
348                             </rules>
349                         </configuration>
350                     </execution>
351                 </executions>
352             </plugin>
353         </plugins>
354     </build>
355 </project>