Move buildhelper to docker profile
[aai/gizmo.git] / pom.xml
1 <!--
2 ============LICENSE_START=======================================================
3 org.onap.aai
4 ================================================================================
5 Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 Copyright © 2017-2018 Amdocs
7 ================================================================================
8 Licensed under the Apache License, Version 2.0 (the "License");
9 you may not use this file except in compliance with the License.
10 You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19 ============LICENSE_END=========================================================
20 -->
21 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23     <modelVersion>4.0.0</modelVersion>
24
25     <parent>
26         <groupId>org.onap.oparent</groupId>
27         <artifactId>oparent</artifactId>
28         <version>2.0.0</version>
29         <relativePath/>
30     </parent>
31
32     <groupId>org.onap.aai.gizmo</groupId>
33     <artifactId>gizmo</artifactId>
34     <version>1.6.0-SNAPSHOT</version>
35     <name>aai-gizmo</name>
36
37     <properties>
38         <docker.location>${basedir}/target</docker.location>
39         <version.org.onap.aai.aai-schema-ingest>1.4.1</version.org.onap.aai.aai-schema-ingest>
40         <version.org.onap.aai.aai-schema>1.5.1</version.org.onap.aai.aai-schema>
41         <version.org.onap.aai.aai-utils>1.5.3</version.org.onap.aai.aai-utils>
42         <version.org.onap.aai.aai-auth>1.5.3</version.org.onap.aai.aai-auth>
43         <event.client.version>1.5.0</event.client.version>
44         <!-- Minimum code coverage percentage. Please update this figure as coverage increases to prevent any drops in
45          coverage caused by new changes. Note that this figure cannot be lower than the ONAP requirement of 0.55 -->
46         <jacoco.line.coverage.limit>0.60</jacoco.line.coverage.limit>
47         <jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
48         <!-- docker related properties -->
49         <docker.fabric.version>0.28.0</docker.fabric.version>
50         <aai.docker.version>1.0.0</aai.docker.version>
51         <aai.build.directory>${project.build.directory}/${project.artifactId}-build/
52         </aai.build.directory>
53         <aai.docker.namespace>onap</aai.docker.namespace>
54         <aai.base.image>alpine</aai.base.image>
55         <aai.base.image.version>1.6.0</aai.base.image.version>
56         <!-- This will be used for the docker images as the default format of maven build has issues -->
57         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
58     </properties>
59
60     <dependencyManagement>
61         <dependencies>
62             <dependency>
63                 <!-- Import dependency management from Spring Boot -->
64                 <groupId>org.springframework.boot</groupId>
65                 <artifactId>spring-boot-dependencies</artifactId>
66                 <version>1.5.21.RELEASE</version>
67                 <type>pom</type>
68                 <scope>import</scope>
69             </dependency>
70         </dependencies>
71     </dependencyManagement>
72
73     <dependencies>
74         <dependency>
75             <groupId>org.springframework.boot</groupId>
76             <artifactId>spring-boot-starter-web</artifactId>
77             <exclusions>
78                 <exclusion>
79                     <groupId>org.springframework.boot</groupId>
80                     <artifactId>spring-boot-starter-tomcat</artifactId>
81                 </exclusion>
82             </exclusions>
83         </dependency>
84         <dependency>
85             <groupId>org.springframework.boot</groupId>
86             <artifactId>spring-boot-starter-jetty</artifactId>
87         </dependency>
88         <dependency>
89             <groupId>org.springframework.boot</groupId>
90             <artifactId>spring-boot-starter</artifactId>
91             <exclusions>
92                 <exclusion>
93                     <groupId>ch.qos.logback</groupId>
94                     <artifactId>logback-classic</artifactId>
95                 </exclusion>
96             </exclusions>
97         </dependency>
98         <dependency>
99             <groupId>org.springframework.boot</groupId>
100             <artifactId>spring-boot-starter-jersey</artifactId>
101             <exclusions>
102                 <exclusion>
103                     <groupId>org.springframework.boot</groupId>
104                     <artifactId>spring-boot-starter-tomcat</artifactId>
105                 </exclusion>
106             </exclusions>
107         </dependency>
108         <dependency>
109             <groupId>org.springframework.boot</groupId>
110             <artifactId>spring-boot-starter-actuator</artifactId>
111         </dependency>
112         <dependency>
113             <groupId>org.springframework.boot</groupId>
114             <artifactId>spring-boot-configuration-processor</artifactId>
115             <optional>true</optional>
116         </dependency>
117         <dependency>
118             <groupId>org.springframework.boot</groupId>
119             <artifactId>spring-boot-starter-test</artifactId>
120             <scope>test</scope>
121         </dependency>
122         <dependency>
123             <groupId>org.apache.cxf</groupId>
124             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
125             <version>3.2.5</version>
126         </dependency>
127
128
129         <dependency>
130             <groupId>io.swagger</groupId>
131             <artifactId>swagger-jersey2-jaxrs</artifactId>
132             <version>1.5.8</version>
133         </dependency>
134         <dependency>
135             <groupId>io.springfox</groupId>
136             <artifactId>springfox-swagger2</artifactId>
137             <version>2.9.2</version>
138         </dependency>
139         <dependency>
140             <groupId>io.springfox</groupId>
141             <artifactId>springfox-swagger-ui</artifactId>
142             <version>2.9.2</version>
143         </dependency>
144
145
146         <!-- ONAP AAI-COMMON (incl. model) -->
147         <dependency>
148             <groupId>org.onap.aai.schema-service</groupId>
149             <artifactId>aai-schema</artifactId>
150             <version>${version.org.onap.aai.aai-schema}</version>
151         </dependency>
152         <dependency>
153             <groupId>org.onap.aai.aai-common</groupId>
154             <artifactId>aai-schema-ingest</artifactId>
155             <version>${version.org.onap.aai.aai-schema-ingest}</version>
156             <exclusions>
157                 <exclusion>
158                     <groupId>org.powermock</groupId>
159                     <artifactId>*</artifactId>
160                 </exclusion>
161             </exclusions>
162         </dependency>
163         <dependency>
164             <groupId>org.onap.aai.aai-common</groupId>
165             <artifactId>aai-utils</artifactId>
166             <version>${version.org.onap.aai.aai-utils}</version>
167         </dependency>
168         <dependency>
169             <groupId>org.onap.aai.aai-common</groupId>
170             <artifactId>aai-auth</artifactId>
171             <version>${version.org.onap.aai.aai-auth}</version>
172         </dependency>
173
174         <!-- ONAP EVENT CLIENT -->
175         <dependency>
176             <groupId>org.onap.aai.event-client</groupId>
177             <artifactId>event-client-dmaap</artifactId>
178             <version>${event.client.version}</version>
179             <exclusions>
180                 <exclusion>
181                     <groupId>org.slf4j</groupId>
182                     <artifactId>slf4j-api</artifactId>
183                 </exclusion>
184             </exclusions>
185         </dependency>
186         <dependency>
187             <groupId>org.onap.aai.event-client</groupId>
188             <artifactId>event-client-kafka</artifactId>
189             <version>${event.client.version}</version>
190             <exclusions>
191                 <exclusion>
192                     <groupId>org.slf4j</groupId>
193                     <artifactId>slf4j-api</artifactId>
194                 </exclusion>
195             </exclusions>
196         </dependency>
197
198         <dependency>
199             <groupId>org.onap.aai.event-client</groupId>
200             <artifactId>event-client-rabbitmq</artifactId>
201             <version>${event.client.version}</version>
202             <exclusions>
203                 <exclusion>
204                     <groupId>org.slf4j</groupId>
205                     <artifactId>slf4j-api</artifactId>
206                 </exclusion>
207             </exclusions>
208         </dependency>
209
210         <!-- ONAP COMMON LOGGING -->
211         <dependency>
212             <groupId>org.onap.aai.logging-service</groupId>
213             <artifactId>common-logging</artifactId>
214             <version>1.2.2</version>
215             <exclusions>
216                 <exclusion>
217                     <groupId>ch.qos.logback</groupId>
218                     <artifactId>logback-classic</artifactId>
219                 </exclusion>
220                 <exclusion>
221                     <groupId>ch.qos.logback</groupId>
222                     <artifactId>logback-core</artifactId>
223                 </exclusion>
224                 <exclusion>
225                     <groupId>org.slf4j</groupId>
226                     <artifactId>slf4j-api</artifactId>
227                 </exclusion>
228             </exclusions>
229         </dependency>
230
231         <!-- ONAP REST CLIENT -->
232         <dependency>
233             <groupId>org.onap.aai</groupId>
234             <artifactId>rest-client</artifactId>
235             <version>1.5.0</version>
236         </dependency>
237
238         <dependency>
239             <groupId>ch.qos.logback</groupId>
240             <artifactId>logback-classic</artifactId>
241             <version>1.2.3</version>
242         </dependency>
243         <dependency>
244             <groupId>ch.qos.logback</groupId>
245             <artifactId>logback-core</artifactId>
246             <version>1.2.3</version>
247             <exclusions>
248                 <exclusion>
249                     <groupId>ch.qos.logback</groupId>
250                     <artifactId>logback-classic</artifactId>
251                 </exclusion>
252             </exclusions>
253         </dependency>
254         <dependency>
255             <groupId>ch.qos.logback</groupId>
256             <artifactId>logback-access</artifactId>
257             <version>1.2.3</version>
258         </dependency>
259         <dependency>
260             <groupId>com.google.guava</groupId>
261             <artifactId>guava</artifactId>
262         </dependency>
263         <dependency>
264             <groupId>radeox</groupId>
265             <artifactId>radeox</artifactId>
266             <version>1.0-b2</version>
267         </dependency>
268         <dependency>
269             <groupId>org.codehaus.jackson</groupId>
270             <artifactId>jackson-mapper-asl</artifactId>
271             <version>1.4.5</version>
272         </dependency>
273         <dependency>
274             <groupId>commons-io</groupId>
275             <artifactId>commons-io</artifactId>
276             <version>2.4</version>
277         </dependency>
278         <dependency>
279             <groupId>org.apache.commons</groupId>
280             <artifactId>commons-lang3</artifactId>
281             <version>3.3.1</version>
282         </dependency>
283         <dependency>
284             <groupId>com.google.code.gson</groupId>
285             <artifactId>gson</artifactId>
286             <version>2.6.2</version>
287         </dependency>
288         <dependency>
289             <groupId>org.eclipse.persistence</groupId>
290             <artifactId>eclipselink</artifactId>
291             <version>2.6.2</version>
292         </dependency>
293         <dependency>
294             <groupId>net.dongliu</groupId>
295             <artifactId>gson-java8-datatype</artifactId>
296             <version>1.0.3</version>
297         </dependency>
298         <dependency>
299             <groupId>com.jayway.jsonpath</groupId>
300             <artifactId>json-path</artifactId>
301             <version>2.2.0</version>
302             <exclusions>
303                 <exclusion>
304                     <groupId>org.slf4j</groupId>
305                     <artifactId>slf4j-api</artifactId>
306                 </exclusion>
307             </exclusions>
308         </dependency>
309         <dependency>
310             <groupId>org.apache.tinkerpop</groupId>
311             <artifactId>gremlin-core</artifactId>
312             <version>3.2.3</version>
313             <scope>provided</scope>
314             <exclusions>
315                 <exclusion>
316                     <groupId>org.slf4j</groupId>
317                     <artifactId>slf4j-log4j12</artifactId>
318                 </exclusion>
319                 <exclusion>
320                     <groupId>org.slf4j</groupId>
321                     <artifactId>jcl-over-slf4j</artifactId>
322                 </exclusion>
323                 <exclusion>
324                     <groupId>org.slf4j</groupId>
325                     <artifactId>slf4j-api</artifactId>
326                 </exclusion>
327             </exclusions>
328         </dependency>
329         <dependency>
330             <groupId>org.apache.tinkerpop</groupId>
331             <artifactId>tinkergraph-gremlin</artifactId>
332             <version>3.2.3</version>
333             <scope>provided</scope>
334         </dependency>
335         <dependency>
336             <groupId>org.json</groupId>
337             <artifactId>json</artifactId>
338             <version>20160212</version>
339         </dependency>
340         <dependency>
341             <groupId>org.apache.httpcomponents</groupId>
342             <artifactId>httpclient</artifactId>
343             <version>4.5.3</version>
344         </dependency>
345         <dependency>
346             <groupId>org.apache.httpcomponents</groupId>
347             <artifactId>httpcore</artifactId>
348             <version>4.4.1</version>
349         </dependency>
350
351         <!-- TEST DEPENDENCIES -->
352         <dependency>
353             <groupId>junit</groupId>
354             <artifactId>junit</artifactId>
355         </dependency>
356         <dependency>
357             <groupId>org.skyscreamer</groupId>
358             <artifactId>jsonassert</artifactId>
359             <version>1.5.0</version>
360             <scope>test</scope>
361         </dependency>
362         <dependency>
363             <groupId>org.mockito</groupId>
364             <artifactId>mockito-core</artifactId>
365             <version>2.15.0</version>
366             <scope>test</scope>
367             <exclusions>
368                 <exclusion>
369                     <groupId>org.hamcrest</groupId>
370                     <artifactId>hamcrest-library</artifactId>
371                 </exclusion>
372             </exclusions>
373         </dependency>
374     </dependencies>
375
376     <profiles>
377         <!-- Docker profile to be used for building docker image and pushing to nexus -->
378         <profile>
379             <id>docker</id>
380             <build>
381                 <plugins>
382                     <plugin>
383                         <groupId>org.codehaus.groovy.maven</groupId>
384                         <artifactId>gmaven-plugin</artifactId>
385                         <version>1.0</version>
386                         <executions>
387                             <execution>
388                                 <phase>validate</phase>
389                                 <goals>
390                                     <goal>execute</goal>
391                                 </goals>
392                                 <configuration>
393                                     <source>
394                                         def userAaiBaseImage = session.userProperties['aai.base.image']
395                                         def userAaiCommonVersion = session.userProperties['aai.base.image.version']
396                                         if (userAaiCommonVersion != null) {
397                                             project.properties['aai.base.image.version'] = userAaiCommonVersion
398                                         }
399                                         if (userAaiBaseImage != null) {
400                                             project.properties['aai.base.image'] = userAaiBaseImage
401                                         }
402                                         log.info 'Base image flavour: ' + project.properties['aai.base.image']
403                                         log.info 'Base image version: ' + project.properties['aai.base.image.version']
404
405                                         def versionArray;
406                                         if (project.properties['aai.base.image.version'] != null) {
407                                             versionArray = project.properties['aai.base.image.version'].split('\\.');
408                                         }
409     
410                                         project.properties["project.major.version"] = versionArray[0];
411                                         project.properties["project.minor.version"] = versionArray[1];
412                                         project.properties['project.docker.latesttag.version'] = versionArray[0] + '.' + versionArray[1] + '-STAGING-latest';
413                                         println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
414                                     </source>
415                                 </configuration>
416                             </execution>
417                         </executions>
418                     </plugin>
419                     <plugin>
420                         <groupId>io.fabric8</groupId>
421                         <artifactId>docker-maven-plugin</artifactId>
422                         <version>${docker.fabric.version}</version>
423                         <configuration>
424                             <verbose>true</verbose>
425                             <apiVersion>1.23</apiVersion>
426                             <images>
427                                 <image>
428                                     <name>${docker.push.registry}/${aai.docker.namespace}/${project.artifactId}:%l
429                                     </name>
430                                     <build>
431                                         <filter>@</filter>
432                                         <tags>
433                                             <tag>latest</tag>
434                                             <tag>${project.docker.latesttag.version}</tag>
435                                             <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-${maven.build.timestamp}</tag>
436                                         </tags>
437                                         <cleanup>try</cleanup>
438                                         <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
439                                         <assembly>
440                                             <inline>
441                                                 <fileSets>
442                                                     <fileSet>
443                                                         <directory>${aai.build.directory}</directory>
444                                                         <outputDirectory>/${project.artifactId}</outputDirectory>
445                                                     </fileSet>
446                                                 </fileSets>
447                                             </inline>
448                                         </assembly>
449                                     </build>
450                                 </image>
451                             </images>
452                         </configuration>
453                         <executions>
454                             <execution>
455                                 <id>clean-images</id>
456                                 <phase>pre-clean</phase>
457                                 <goals>
458                                     <goal>remove</goal>
459                                 </goals>
460                                 <configuration>
461                                     <removeAll>true</removeAll>
462                                 </configuration>
463                             </execution>
464                             <execution>
465                                 <id>generate-images</id>
466                                 <phase>package</phase>
467                                 <goals>
468                                     <goal>build</goal>
469                                 </goals>
470                             </execution>
471                             <execution>
472                                 <id>push-images</id>
473                                 <phase>deploy</phase>
474                                 <goals>
475                                     <goal>push</goal>
476                                 </goals>
477                             </execution>
478                         </executions>
479                     </plugin>
480                     <plugin>
481                       <groupId>org.codehaus.mojo</groupId>
482                       <artifactId>build-helper-maven-plugin</artifactId>
483                       <version>3.0.0</version>
484                       <executions>
485                         <execution>
486                           <id>parse-version</id>
487                           <goals>
488                             <goal>parse-version</goal>
489                           </goals>
490                         </execution>
491                       </executions>
492                     </plugin>
493                   </plugins>
494             </build>
495         </profile>
496     </profiles>
497
498     <build>
499         <finalName>${project.artifactId}</finalName>
500         <plugins>
501             <!--
502             Using https://code.revelc.net/formatter-maven-plugin/ for Eclipse formatter
503             Using https://github.com/diffplug/spotless/tree/master/plugin-maven for import order
504             Use in combination to rewrite code and imports, then checkstyle
505
506             mvn formatter:format spotless:apply process-sources
507             -->
508             <plugin>
509                 <groupId>net.revelc.code.formatter</groupId>
510                 <artifactId>formatter-maven-plugin</artifactId>
511                 <version>2.8.1</version>
512                 <configuration>
513                     <configFile>${project.basedir}/onap-java-formatter.xml</configFile>
514                 </configuration>
515                 <!-- https://code.revelc.net/formatter-maven-plugin/
516                      use mvn formatter:format to rewrite source files
517                      use mvn formatter:validate to validate source files -->
518             </plugin>
519             <plugin>
520                 <groupId>com.diffplug.spotless</groupId>
521                 <artifactId>spotless-maven-plugin</artifactId>
522                 <version>1.18.0</version>
523                 <configuration>
524                     <java>
525                         <importOrder>
526                             <order>com,java,javax,org</order>
527                         </importOrder>
528                     </java>
529                 </configuration>
530                 <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven
531                      use mvn spotless:apply to rewrite source files
532                      use mvn spotless:check to validate source files -->
533             </plugin>
534             <!-- license plugin -->
535             <!-- Uncomment this to add a license header to every source file -->
536             <plugin>
537                 <groupId>com.mycila</groupId>
538                 <artifactId>license-maven-plugin</artifactId>
539                 <version>3.0</version>
540                 <configuration>
541                     <header>License.txt</header>
542                     <includes>
543                         <include>src/main/java/**</include>
544                         <include>src/test/java/**</include>
545                         <include>pom.xml</include>
546                     </includes>
547                     <skipExistingHeaders>true</skipExistingHeaders>
548                 </configuration>
549                 <executions>
550                     <execution>
551                         <goals>
552                             <!-- Set goal from "check" to "format" to auto update license headers -->
553                             <goal>check</goal>
554                         </goals>
555                         <phase>process-sources</phase>
556                     </execution>
557                 </executions>
558             </plugin>
559
560             <plugin>
561                 <groupId>org.apache.maven.plugins</groupId>
562                 <artifactId>maven-site-plugin</artifactId>
563                 <version>3.3</version>
564                 <configuration>
565                     <reportPlugins>
566                         <plugin>
567                             <groupId>org.apache.maven.plugins</groupId>
568                             <artifactId>maven-checkstyle-plugin</artifactId>
569                             <version>2.17</version>
570                             <reportSets>
571                                 <reportSet>
572                                     <reports>
573                                         <report>checkstyle</report>
574                                     </reports>
575                                 </reportSet>
576                             </reportSets>
577                         </plugin>
578                     </reportPlugins>
579                 </configuration>
580             </plugin>
581             <plugin>
582                 <groupId>org.apache.maven.plugins</groupId>
583                 <artifactId>maven-deploy-plugin</artifactId>
584             </plugin>
585             <plugin>
586                 <groupId>org.springframework.boot</groupId>
587                 <artifactId>spring-boot-maven-plugin</artifactId>
588                 <version>2.0.1.RELEASE</version>
589                 <executions>
590                     <execution>
591                         <goals>
592                             <goal>repackage</goal>
593                         </goals>
594                     </execution>
595                 </executions>
596             </plugin>
597             <plugin>
598                 <artifactId>maven-assembly-plugin</artifactId>
599                 <configuration>
600                     <descriptors>
601                         <descriptor>src/main/assembly/descriptor.xml</descriptor>
602                     </descriptors>
603                 </configuration>
604                 <executions>
605                     <execution>
606                         <id>make-assembly</id>
607                         <phase>package</phase>
608                         <goals>
609                             <goal>single</goal>
610                         </goals>
611                     </execution>
612                 </executions>
613             </plugin>
614             <plugin>
615                 <groupId>org.apache.maven.plugins</groupId>
616                 <artifactId>maven-dependency-plugin</artifactId>
617                 <executions>
618                     <execution>
619                         <id>unpack</id>
620                         <phase>prepare-package</phase>
621                         <goals>
622                             <goal>unpack</goal>
623                         </goals>
624                         <configuration>
625                             <artifactItems>
626                                 <artifactItem>
627                                     <groupId>org.onap.aai.schema-service</groupId>
628                                     <artifactId>aai-schema</artifactId>
629                                     <version>${version.org.onap.aai.aai-schema}</version>
630                                     <type>jar</type>
631                                     <includes>onap/**/</includes>
632                                     <outputDirectory>${aai.build.directory}/bundleconfig/etc</outputDirectory>
633                                 </artifactItem>
634                             </artifactItems>
635                         </configuration>
636                     </execution>
637                 </executions>
638             </plugin>
639             <plugin>
640                 <groupId>org.jacoco</groupId>
641                 <artifactId>jacoco-maven-plugin</artifactId>
642                 <executions>
643                     <execution>
644                         <id>default-check</id>
645                         <goals>
646                             <goal>check</goal>
647                         </goals>
648                         <configuration>
649                             <dataFile>${jacoco.report.directory}/jacoco-ut.exec</dataFile>
650                             <rules>
651                                 <!--  implementation is needed only for Maven 2  -->
652                                 <rule implementation="org.jacoco.maven.RuleConfiguration">
653                                     <element>BUNDLE</element>
654                                     <limits>
655                                         <limit implementation="org.jacoco.report.check.Limit">
656                                             <counter>LINE</counter>
657                                             <value>COVEREDRATIO</value>
658                                             <minimum>${jacoco.line.coverage.limit}</minimum>
659                                         </limit>
660                                     </limits>
661                                 </rule>
662                             </rules>
663                         </configuration>
664                     </execution>
665                 </executions>
666             </plugin>
667
668         </plugins>
669     </build>
670
671     <distributionManagement>
672         <site>
673             <id>ecomp-javadoc</id>
674             <url>dav:https://ecomp-nexus:8443/repository/aai/gizmo-javadoc/${project.version}</url>
675         </site>
676     </distributionManagement>
677 </project>