Add docker image building to maven configuration
[oom/platform/cert-service.git] / certService / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3     ================================================================================
4         Copyright (c) 2020 Nokia. All rights reserved.
5         ================================================================================
6         Licensed under the Apache License, Version 2.0 (the "License"); you may not
7         use this file except in compliance with the License. You may obtain a copy
8         of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
9         by applicable law or agreed to in writing, software distributed under the
10         License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
11         OF ANY KIND, either express or implied. See the License for the specific
12         language governing permissions and limitations under the License.
13         ============LICENSE_END=========================================================
14 -->
15 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
17     <modelVersion>4.0.0</modelVersion>
18     <parent>
19         <groupId>org.onap.aaf</groupId>
20         <artifactId>aaf-certservice-parent</artifactId>
21         <version>0.0.1-SNAPSHOT</version>
22     </parent>
23     <groupId>org.onap.aaf</groupId>
24     <artifactId>cert-service</artifactId>
25     <version>0.0.1-SNAPSHOT</version>
26     <name>cert-service</name>
27     <description>Certification service</description>
28     <packaging>jar</packaging>
29
30     <properties>
31         <java.version>11</java.version>
32         <assertj-core.version>3.11.1</assertj-core.version>
33         <mockito-core.version>3.2.4</mockito-core.version>
34         <spring-core.version>5.2.3.RELEASE</spring-core.version>
35         <spring-boot-starter.version>2.2.4.RELEASE</spring-boot-starter.version>
36         <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
37         <maven-surefire-plugin.version>3.0.0-M1</maven-surefire-plugin.version>
38         <spring-boot-starter-actuator.version>2.2.4.RELEASE</spring-boot-starter-actuator.version>
39         <spring-boot-starter-log4j2.version>2.1.5.RELEASE</spring-boot-starter-log4j2.version>
40         <springdoc-openapi-ui.version>1.2.21</springdoc-openapi-ui.version>
41         <docker-maven-plugin.version>0.33.0</docker-maven-plugin.version>
42     </properties>
43
44     <dependencyManagement>
45         <dependencies>
46             <dependency>
47                 <!-- Import dependency management from Spring Boot -->
48                 <groupId>org.springframework.boot</groupId>
49                 <artifactId>spring-boot-dependencies</artifactId>
50                 <version>${spring-boot-starter.version}</version>
51                 <type>pom</type>
52                 <scope>import</scope>
53             </dependency>
54         </dependencies>
55     </dependencyManagement>
56
57     <dependencies>
58         <dependency>
59             <groupId>org.springframework.boot</groupId>
60             <artifactId>spring-boot-starter-web</artifactId>
61             <version>${spring-boot-starter.version}</version>
62             <exclusions>
63                 <exclusion>
64                     <groupId>org.springframework.boot</groupId>
65                     <artifactId>spring-boot-starter-logging</artifactId>
66                 </exclusion>
67             </exclusions>
68         </dependency>
69         <dependency>
70             <groupId>org.springframework.boot</groupId>
71             <artifactId>spring-boot-starter-log4j2</artifactId>
72             <version>${spring-boot-starter-log4j2.version}</version>
73         </dependency>
74         <dependency>
75             <groupId>org.springframework.boot</groupId>
76             <artifactId>spring-boot-starter-test</artifactId>
77             <version>${spring-boot-starter.version}</version>
78             <scope>test</scope>
79             <exclusions>
80                 <exclusion>
81                     <groupId>org.junit.vintage</groupId>
82                     <artifactId>junit-vintage-engine</artifactId>
83                 </exclusion>
84             </exclusions>
85         </dependency>
86         <dependency>
87             <groupId>org.mockito</groupId>
88             <artifactId>mockito-core</artifactId>
89             <version>${mockito-core.version}</version>
90             <scope>test</scope>
91         </dependency>
92         <dependency>
93             <groupId>org.assertj</groupId>
94             <artifactId>assertj-core</artifactId>
95             <version>${assertj-core.version}</version>
96             <scope>test</scope>
97         </dependency>
98         <dependency>
99             <groupId>org.springframework.boot</groupId>
100             <artifactId>spring-boot-starter-actuator</artifactId>
101             <version>${spring-boot-starter-actuator.version}</version>
102         </dependency>
103         <dependency>
104             <groupId>org.springdoc</groupId>
105             <artifactId>springdoc-openapi-ui</artifactId>
106             <version>${springdoc-openapi-ui.version}</version>
107         </dependency>
108     </dependencies>
109
110     <build>
111         <pluginManagement>
112             <plugins>
113                 <plugin>
114                     <groupId>org.springframework.boot</groupId>
115                     <artifactId>spring-boot-maven-plugin</artifactId>
116                     <version>${spring-boot-starter.version}</version>
117                 </plugin>
118                 <plugin>
119                     <artifactId>maven-javadoc-plugin</artifactId>
120                     <version>${maven-javadoc-plugin.version}</version>
121                 </plugin>
122                 <plugin>
123                     <groupId>org.apache.maven.plugins</groupId>
124                     <artifactId>maven-surefire-plugin</artifactId>
125                     <version>${maven-surefire-plugin.version}</version>
126                 </plugin>
127
128             </plugins>
129         </pluginManagement>
130         <plugins>
131             <plugin>
132                 <groupId>org.springframework.boot</groupId>
133                 <artifactId>spring-boot-maven-plugin</artifactId>
134                 <executions>
135                     <execution>
136                         <goals>
137                             <goal>repackage</goal>
138                         </goals>
139                     </execution>
140                 </executions>
141             </plugin>
142             <plugin>
143                 <artifactId>maven-javadoc-plugin</artifactId>
144                 <configuration>
145                     <quiet>true</quiet>
146                     <verbose>false</verbose>
147                     <useStandardDocletOptions>false</useStandardDocletOptions>
148                     <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
149                 </configuration>
150                 <executions>
151                     <execution>
152                         <id>aggregate</id>
153                         <phase>site</phase>
154                         <goals>
155                             <goal>aggregate</goal>
156                         </goals>
157                     </execution>
158                     <execution>
159                         <id>attach-javadoc</id>
160                         <goals>
161                             <goal>jar</goal>
162                         </goals>
163                     </execution>
164                 </executions>
165             </plugin>
166         </plugins>
167     </build>
168
169     <profiles>
170         <profile>
171             <id>docker</id>
172             <activation>
173                 <activeByDefault>false</activeByDefault>
174             </activation>
175             <build>
176                 <plugins>
177                     <plugin>
178                         <groupId>io.fabric8</groupId>
179                         <artifactId>docker-maven-plugin</artifactId>
180                         <version>${docker-maven-plugin.version}</version>
181                         <executions>
182                             <execution>
183                                 <id>start</id>
184                                 <phase>pre-integration-test</phase>
185                                 <goals>
186                                     <goal>build</goal>
187                                     <goal>start</goal>
188                                 </goals>
189                             </execution>
190                             <execution>
191                                 <id>stop</id>
192                                 <phase>post-integration-test</phase>
193                                 <goals>
194                                     <goal>stop</goal>
195                                 </goals>
196                             </execution>
197                         </executions>
198                         <configuration>
199                             <images>
200                                 <image>
201                                     <name>cert-service</name>
202                                     <build>
203                                         <dockerFile>${project.basedir}/Dockerfile</dockerFile >
204                                     </build>
205                                     <run>
206                                         <ports>
207                                             <port>8080:8080</port>
208                                         </ports>
209                                         <wait>
210                                             <!-- Check for this URL to return a 200 return code .... -->
211                                             <url>http://localhost:8080/actuator/health</url>
212                                             <time>120000</time>
213                                         </wait>
214                                     </run>
215                                 </image>
216                             </images>
217                         </configuration>
218                     </plugin>
219                 </plugins>
220             </build>
221         </profile>
222     </profiles>
223 </project>