Enforce minimum Jacoco line coverage
[aai/model-loader.git] / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3     ============LICENSE_START=======================================================
4     org.onap.aai
5     ================================================================================
6     Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
7     Copyright © 2017-2018 European Software Marketing Ltd.
8     ================================================================================
9     Licensed under the Apache License, Version 2.0 (the "License");
10     you may not use this file except in compliance with the License.
11     You may obtain a copy of the License at
12
13           http://www.apache.org/licenses/LICENSE-2.0
14
15     Unless required by applicable law or agreed to in writing, software
16     distributed under the License is distributed on an "AS IS" BASIS,
17     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18     See the License for the specific language governing permissions and
19     limitations under the License.
20     ============LICENSE_END=========================================================
21 -->
22 <project xmlns="http://maven.apache.org/POM/4.0.0" 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         <modelVersion>4.0.0</modelVersion>
25
26         <parent>
27                 <groupId>org.onap.oparent</groupId>
28                 <artifactId>oparent</artifactId>
29                 <version>2.0.0</version>
30                 <relativePath />
31         </parent>
32
33         <groupId>org.onap.aai.model-loader</groupId>
34         <artifactId>model-loader</artifactId>
35         <name>aai-model-loader</name>
36         <version>1.5.0-SNAPSHOT</version>
37
38         <dependencyManagement>
39                 <dependencies>
40                         <dependency>
41                                 <groupId>org.springframework.boot</groupId>
42                                 <artifactId>spring-boot-dependencies</artifactId>
43                                 <version>${spring-boot.version}</version>
44                                 <type>pom</type>
45                                 <scope>import</scope>
46                         </dependency>
47                 </dependencies>
48         </dependencyManagement>
49
50         <properties>
51                 <start-class>org.onap.aai.modelloader.service.ModelLoaderApplication</start-class>
52                 <nexusproxy>https://nexus.onap.org</nexusproxy>
53                 <docker.location>${basedir}/target</docker.location>
54                 <spring-boot.version>2.1.6.RELEASE</spring-boot.version>
55                 <apache.commons-text.version>1.1</apache.commons-text.version>
56                 <commons-compress.version>1.18</commons-compress.version>
57                 <hamcrest-all.version>1.3</hamcrest-all.version>
58                 <babel.version>1.3.1</babel.version>
59                 <aai.rest.client.version>1.2.1</aai.rest.client.version>
60                 <sdc-distribution-client.version>1.3.0</sdc-distribution-client.version>
61                 <logback.version>1.2.3</logback.version>
62                 <!-- docker related properties -->
63                 <docker.fabric.version>0.28.0</docker.fabric.version>
64                 <aai.docker.version>1.0.0</aai.docker.version>
65                 <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/</aai.build.directory>
66                 <aai.docker.namespace>onap</aai.docker.namespace>
67                 <aai.base.image>alpine</aai.base.image>
68                 <aai.base.image.version>1.6.0</aai.base.image.version>
69                 <!-- This will be used for the docker images as the default format of maven build has issues -->
70                 <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
71                 <!-- Code coverage enforcement -->
72                 <jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
73                 <jacoco.line.coverage.limit>0.80</jacoco.line.coverage.limit>
74         </properties>
75
76         <distributionManagement>
77                 <repository>
78                         <id>ecomp-releases</id>
79                         <name>ECOMP Release Repository</name>
80                         <url>${nexusproxy}/content/repositories/releases/</url>
81                 </repository>
82                 <snapshotRepository>
83                         <id>ecomp-snapshots</id>
84                         <name>ECOMP Snapshot Repository</name>
85                         <url>${nexusproxy}/content/repositories/snapshots/</url>
86                 </snapshotRepository>
87         </distributionManagement>
88
89         <profiles>
90                 <!-- Docker profile to be used for building docker image and pushing to nexus -->
91                 <profile>
92                         <id>docker</id>
93                         <build>
94                                 <plugins>
95                                         <plugin>
96                                                 <groupId>org.codehaus.mojo</groupId>
97                                                 <artifactId>build-helper-maven-plugin</artifactId>
98                                                 <version>3.0.0</version>
99                                                 <executions>
100                                                         <execution>
101                                                                 <phase>pre-clean</phase>
102                                                                 <id>parse-version</id>
103                                                                 <goals>
104                                                                         <goal>parse-version</goal>
105                                                                 </goals>
106                                                         </execution>
107                                                 </executions>
108                                         </plugin>
109                                         <plugin>
110                                                 <groupId>org.codehaus.groovy.maven</groupId>
111                                                 <artifactId>gmaven-plugin</artifactId>
112                                                 <version>1.0</version>
113                                                 <executions>
114                                                         <execution>
115                                                                 <phase>pre-clean</phase>
116                                                                 <goals>
117                                                                         <goal>execute</goal>
118                                                                 </goals>
119                                                                 <configuration>
120                                                                         <source>
121                                                                                 def userAaiBaseImage = session.userProperties['aai.base.image'];
122                                                                                 def userAaiCommonVersion = session.userProperties['aai.base.image.version'];
123                                                                                 if (userAaiCommonVersion != null) {
124                                                                                         project.properties['aai.base.image.version'] = userAaiCommonVersion;
125                                                                                 }
126                                                                                 if (userAaiBaseImage != null) {
127                                                                                         project.properties['aai.base.image'] = userAaiBaseImage;
128                                                                                 }
129                                                                                 log.info 'Base image flavour: ' + project.properties['aai.base.image'];
130                                                                                 log.info 'Base image version: ' + project.properties['aai.base.image.version'];
131                                                                         </source>
132                                                                 </configuration>
133                                                         </execution>
134                                                 </executions>
135                                         </plugin>
136                                         <plugin>
137                                                 <groupId>io.fabric8</groupId>
138                                                 <artifactId>docker-maven-plugin</artifactId>
139                                                 <version>${docker.fabric.version}</version>
140                                                 <configuration>
141                                                         <verbose>true</verbose>
142                                                         <apiVersion>1.23</apiVersion>
143                                                         <images>
144                                                                 <image>
145                                                                         <name>${docker.push.registry}/${aai.docker.namespace}/${project.artifactId}:%l</name>
146                                                                         <build>
147                                                                                 <filter>@</filter>
148                                                                                 <tags>
149                                                                                         <tag>latest</tag>
150                                                                                         <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag>
151                                                                                         <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-${maven.build.timestamp}</tag>
152                                                                                 </tags>
153                                                                                 <cleanup>try</cleanup>
154                                                                                 <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
155                                                                                 <assembly>
156                                                                                         <inline>
157                                                                                                 <fileSets>
158                                                                                                         <fileSet>
159                                                                                                                 <directory>${aai.build.directory}</directory>
160                                                                                                                 <outputDirectory>/${project.artifactId}</outputDirectory>
161                                                                                                         </fileSet>
162                                                                                                 </fileSets>
163                                                                                         </inline>
164                                                                                 </assembly>
165                                                                         </build>
166                                                                 </image>
167                                                         </images>
168                                                 </configuration>
169                                                 <executions>
170                                                         <execution>
171                                                                 <id>clean-images</id>
172                                                                 <phase>pre-clean</phase>
173                                                                 <goals>
174                                                                         <goal>remove</goal>
175                                                                 </goals>
176                                                                 <configuration>
177                                                                         <removeAll>true</removeAll>
178                                                                 </configuration>
179                                                         </execution>
180                                                         <execution>
181                                                                 <id>generate-images</id>
182                                                                 <phase>package</phase>
183                                                                 <goals>
184                                                                         <goal>build</goal>
185                                                                 </goals>
186                                                         </execution>
187                                                         <execution>
188                                                                 <id>push-images</id>
189                                                                 <phase>deploy</phase>
190                                                                 <goals>
191                                                                         <goal>push</goal>
192                                                                 </goals>
193                                                         </execution>
194                                                 </executions>
195                                         </plugin>
196                                 </plugins>
197                         </build>
198                 </profile>
199         </profiles>
200
201         <dependencies>
202                 <dependency>
203                         <groupId>org.springframework.boot</groupId>
204                         <artifactId>spring-boot-starter-jetty</artifactId>
205                 </dependency>
206                 <dependency>
207                         <groupId>org.springframework.boot</groupId>
208                         <artifactId>spring-boot-starter-web</artifactId>
209                         <exclusions>
210                           <exclusion>
211                             <groupId>org.springframework.boot</groupId>
212                             <artifactId>spring-boot-starter-tomcat</artifactId>
213                           </exclusion>
214                         </exclusions>
215                 </dependency>
216                 <dependency>
217                         <groupId>org.onap.aai</groupId>
218                         <artifactId>babel</artifactId>
219                         <version>${babel.version}</version>
220                         <classifier>client</classifier>
221                         <exclusions>
222                                 <exclusion>
223                                         <groupId>*</groupId>
224                                         <artifactId>*</artifactId>
225                                 </exclusion>
226                         </exclusions>
227                 </dependency>
228                 <dependency>
229                         <groupId>org.glassfish.jersey.core</groupId>
230                         <artifactId>jersey-common</artifactId>
231                         <scope>test</scope>
232                 </dependency>
233                 <dependency>
234                         <groupId>org.onap.aai</groupId>
235                         <artifactId>rest-client</artifactId>
236                         <version>${aai.rest.client.version}</version>
237                 </dependency>
238                 <dependency>
239                         <groupId>com.google.code.gson</groupId>
240                         <artifactId>gson</artifactId>
241                 </dependency>
242
243                 <!-- Test dependencies -->
244                 <!-- https://mvnrepository.com/artifact/com.mikesamuel/json-sanitizer -->
245                 <dependency>
246                         <groupId>com.mikesamuel</groupId>
247                         <artifactId>json-sanitizer</artifactId>
248                         <version>1.2.0</version>
249                 </dependency>
250
251                 <!-- Common logging framework -->
252                 <dependency>
253                         <groupId>org.onap.aai.logging-service</groupId>
254                         <artifactId>common-logging</artifactId>
255                         <version>1.5.0</version>
256                 </dependency>
257                 <dependency>
258                         <groupId>ch.qos.logback</groupId>
259                         <artifactId>logback-classic</artifactId>
260                         <version>${logback.version}</version><!--$NO-MVN-MAN-VER$ -->
261                 </dependency>
262                 <dependency>
263                         <groupId>ch.qos.logback</groupId>
264                         <artifactId>logback-core</artifactId>
265                         <version>${logback.version}</version><!--$NO-MVN-MAN-VER$ -->
266                 </dependency>
267                 <dependency>
268                         <groupId>org.onap.sdc.sdc-distribution-client</groupId>
269                         <artifactId>sdc-distribution-client</artifactId>
270                         <version>${sdc-distribution-client.version}</version>
271                 </dependency>
272                 <dependency>
273                         <groupId>org.json</groupId>
274                         <artifactId>json</artifactId>
275                         <version>20131018</version><!--$NO-MVN-MAN-VER$ -->
276                 </dependency>
277                 <dependency>
278                         <groupId>org.eclipse.jetty</groupId>
279                         <artifactId>jetty-security</artifactId>
280                 </dependency>
281                 <dependency>
282                         <groupId>jline</groupId>
283                         <artifactId>jline</artifactId>
284                         <version>2.12.1</version>
285                 </dependency>
286                 <dependency>
287                         <groupId>org.apache.commons</groupId>
288                         <artifactId>commons-compress</artifactId>
289                         <version>${commons-compress.version}</version>
290                 </dependency>
291                 <dependency>
292                         <groupId>commons-io</groupId>
293                         <artifactId>commons-io</artifactId>
294                         <version>2.4</version>
295                 </dependency>
296                 <dependency>
297                         <groupId>org.apache.commons</groupId>
298                         <artifactId>commons-text</artifactId>
299                         <version>${apache.commons-text.version}</version>
300                 </dependency>
301
302                 <!-- Test dependencies -->
303                 <dependency>
304                         <groupId>junit</groupId>
305                         <artifactId>junit</artifactId>
306                         <scope>test</scope>
307                 </dependency>
308                 <dependency>
309                         <groupId>org.hamcrest</groupId>
310                         <artifactId>hamcrest-all</artifactId>
311                         <version>${hamcrest-all.version}</version>
312                         <scope>test</scope>
313                 </dependency>
314                 <dependency>
315                         <groupId>org.mockito</groupId>
316                         <artifactId>mockito-core</artifactId>
317                         <scope>test</scope>
318                 </dependency>
319                 <dependency>
320                         <groupId>org.springframework.boot</groupId>
321                         <artifactId>spring-boot-starter-test</artifactId>
322                         <scope>test</scope>
323                 </dependency>
324         </dependencies>
325
326         <!-- Plugins and repositories -->
327         <pluginRepositories>
328                 <pluginRepository>
329                         <id>central</id>
330                         <url>http://repo1.maven.org/maven2</url>
331                 </pluginRepository>
332                 <pluginRepository>
333                         <id>EvoSuite</id>
334                         <name>EvoSuite Repository</name>
335                         <url>http://www.evosuite.org/m2</url>
336                 </pluginRepository>
337         </pluginRepositories>
338
339         <repositories>
340                 <repository>
341                         <id>central</id>
342                         <name>Maven 2 repository 2</name>
343                         <url>http://repo2.maven.org/maven2/</url>
344                 </repository>
345                 <repository>
346                         <id>ecomp-releases</id>
347                         <name>ECOMP Release Repository</name>
348                         <url>${nexusproxy}/content/repositories/releases/</url>
349                 </repository>
350                 <repository>
351                         <id>ecomp-snapshots</id>
352                         <name>ECOMP Snapshot Repository</name>
353                         <url>${nexusproxy}/content/repositories/snapshots/</url>
354                 </repository>
355                 <repository>
356                         <id>ecomp-staging</id>
357                         <name>ECOMP Staging Repository</name>
358                         <url>${nexusproxy}/content/repositories/staging/</url>
359                 </repository>
360         </repositories>
361
362         <build>
363                 <plugins>
364                         <plugin>
365                                 <groupId>org.springframework.boot</groupId>
366                                 <artifactId>spring-boot-maven-plugin</artifactId>
367                                 <version>${spring-boot.version}</version>
368                                 <configuration>
369                                         <executable>true</executable>
370                                 </configuration>
371                                 <executions>
372                                         <execution>
373                                                 <goals>
374                                                         <goal>repackage</goal>
375                                                 </goals>
376                                         </execution>
377                                 </executions>
378                         </plugin>
379                         <plugin>
380                                 <groupId>com.mycila</groupId>
381                                 <artifactId>license-maven-plugin</artifactId>
382                                 <version>3.0</version>
383                                 <configuration>
384                                         <header>License.txt</header>
385                                         <includes>
386                                                 <include>src/main/java/**</include>
387                                                 <include>src/test/java/**</include>
388                                                 <include>version/properties</include>
389                                                 <include>pom.xml</include>
390                                         </includes>
391                                         <skipExistingHeaders>true</skipExistingHeaders>
392                                 </configuration>
393                                 <executions>
394                                         <execution>
395                                                 <goals>
396                                                         <!-- Set goal to "format" to auto update license headers -->
397                                                         <goal>check</goal>
398                                                 </goals>
399                                                 <phase>process-sources</phase>
400                                         </execution>
401                                 </executions>
402                         </plugin>
403                         <plugin>
404                                 <groupId>org.apache.maven.plugins</groupId>
405                                 <artifactId>maven-deploy-plugin</artifactId>
406                                 <configuration>
407                                         <skip>true</skip>
408                                 </configuration>
409                         </plugin>
410                         <plugin>
411                                 <artifactId>maven-assembly-plugin</artifactId>
412                                 <configuration>
413                                         <descriptors>
414                                                 <descriptor>src/main/assembly/descriptor.xml</descriptor>
415                                         </descriptors>
416                                 </configuration>
417                                 <executions>
418                                         <execution>
419                                                 <id>make-assembly</id>
420                                                 <phase>package</phase>
421                                                 <goals>
422                                                         <goal>single</goal>
423                                                 </goals>
424                                         </execution>
425                                 </executions>
426                         </plugin>
427                         <plugin>
428                                 <groupId>org.jacoco</groupId>
429                                 <artifactId>jacoco-maven-plugin</artifactId>
430                                 <executions>
431                                         <execution>
432                                                 <id>default-check</id>
433                                                 <goals>
434                                                         <goal>check</goal>
435                                                 </goals>
436                                                 <configuration>
437                                                         <dataFile>${jacoco.report.directory}/jacoco-ut.exec</dataFile>
438                                                         <rules>
439                                 <!--  implementation is needed only for Maven 2  -->
440                                                                 <rule implementation="org.jacoco.maven.RuleConfiguration">
441                                                                         <element>BUNDLE</element>
442                                                                         <limits>
443                                                                                 <limit implementation="org.jacoco.report.check.Limit">
444                                                                                         <counter>LINE</counter>
445                                                                                         <value>COVEREDRATIO</value>
446                                                                                         <minimum>${jacoco.line.coverage.limit}</minimum>
447                                                                                 </limit>
448                                                                         </limits>
449                                                                 </rule>
450                                                         </rules>
451                                                 </configuration>
452                                         </execution>
453                                 </executions>
454                         </plugin>
455                 </plugins>
456         </build>
457 </project>