small, multi-platform docker images
[dmaap/datarouter.git] / datarouter-subscriber / pom.xml
1 <!--
2   ============LICENSE_START==================================================
3   * org.onap.dmaap
4   * ===========================================================================
5   * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6   * Modifications Copyright (C) 2018 Nokia. All rights reserved.
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   * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22   *
23 -->
24 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25     <modelVersion>4.0.0</modelVersion>
26     <parent>
27         <groupId>org.onap.dmaap.datarouter</groupId>
28         <artifactId>parent</artifactId>
29         <version>2.0.2-SNAPSHOT</version>
30         <relativePath>../pom.xml</relativePath>
31     </parent>
32     <artifactId>datarouter-subscriber</artifactId>
33     <packaging>jar</packaging>
34     <name>datarouter-subscriber</name>
35     <properties>
36         <sonar.language>java</sonar.language>
37         <sonar.skip>false</sonar.skip>
38         <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
39         <sitePath>/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</sitePath>
40
41         <docker.location>${basedir}/target/${artifactId}</docker.location>
42         <datarouter.prov.image.name>onap/dmaap/datarouter-subscriber</datarouter.prov.image.name>
43
44         <timestamp>${maven.build.timestamp}</timestamp>
45         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
46     </properties>
47     <dependencies>
48         <dependency>
49             <groupId>com.google.guava</groupId>
50             <artifactId>guava</artifactId>
51             <version>${google.guava.version}</version>
52         </dependency>
53         <dependency>
54             <groupId>commons-codec</groupId>
55             <artifactId>commons-codec</artifactId>
56             <version>${commons-codec.version}</version>
57         </dependency>
58         <dependency>
59             <groupId>org.eclipse.jetty</groupId>
60             <artifactId>jetty-server</artifactId>
61             <version>${jetty.version}</version>
62         </dependency>
63         <dependency>
64             <groupId>org.eclipse.jetty</groupId>
65             <artifactId>jetty-continuation</artifactId>
66             <version>${jetty.version}</version>
67         </dependency>
68         <dependency>
69             <groupId>org.eclipse.jetty</groupId>
70             <artifactId>jetty-util</artifactId>
71             <version>${jetty.version}</version>
72         </dependency>
73         <dependency>
74             <groupId>org.eclipse.jetty</groupId>
75             <artifactId>jetty-deploy</artifactId>
76             <version>${jetty.version}</version>
77         </dependency>
78         <dependency>
79             <groupId>org.eclipse.jetty</groupId>
80             <artifactId>jetty-servlet</artifactId>
81             <version>${jetty.version}</version>
82         </dependency>
83         <dependency>
84             <groupId>org.eclipse.jetty</groupId>
85             <artifactId>jetty-servlets</artifactId>
86             <version>${jetty.version}</version>
87         </dependency>
88         <dependency>
89             <groupId>org.eclipse.jetty</groupId>
90             <artifactId>jetty-http</artifactId>
91             <version>${jetty.version}</version>
92         </dependency>
93         <dependency>
94             <groupId>org.eclipse.jetty</groupId>
95             <artifactId>jetty-security</artifactId>
96             <version>${jetty.version}</version>
97         </dependency>
98         <dependency>
99             <groupId>org.eclipse.jetty</groupId>
100             <artifactId>jetty-websocket</artifactId>
101             <version>${jetty.websocket.version}</version>
102         </dependency>
103         <dependency>
104             <groupId>org.eclipse.jetty</groupId>
105             <artifactId>jetty-io</artifactId>
106             <version>${jetty.version}</version>
107         </dependency>
108         <dependency>
109             <groupId>com.thoughtworks.xstream</groupId>
110             <artifactId>xstream</artifactId>
111             <version>${thoughtworks.version}</version>
112         </dependency>
113         <dependency>
114             <groupId>ch.qos.logback</groupId>
115             <artifactId>logback-classic</artifactId>
116             <version>${qos.logback.version}</version>
117             <scope>compile</scope>
118         </dependency>
119         <dependency>
120             <groupId>ch.qos.logback</groupId>
121             <artifactId>logback-core</artifactId>
122             <version>${qos.logback.version}</version>
123             <scope>compile</scope>
124         </dependency>
125         <dependency>
126             <groupId>org.apache.httpcomponents</groupId>
127             <artifactId>httpclient</artifactId>
128             <version>4.5.3</version>
129         </dependency>
130         <dependency>
131             <groupId>org.sonatype.http-testing-harness</groupId>
132             <artifactId>junit-runner</artifactId>
133             <version>0.11</version>
134             <exclusions>
135                 <exclusion>
136                     <groupId>org.databene</groupId>
137                     <artifactId>contiperf</artifactId>
138                 </exclusion>
139             </exclusions>
140         </dependency>
141         <dependency>
142             <groupId>junit</groupId>
143             <artifactId>junit</artifactId>
144             <version>4.10</version>
145             <scope>test</scope>
146         </dependency>
147         <dependency>
148             <groupId>log4j</groupId>
149             <artifactId>log4j</artifactId>
150             <version>1.2.17</version>
151             <scope>compile</scope>
152         </dependency>
153         <dependency>
154             <groupId>org.apache.commons</groupId>
155             <artifactId>commons-io</artifactId>
156             <version>1.3.2</version>
157         </dependency>
158     </dependencies>
159     <profiles>
160         <profile>
161             <id>docker</id>
162             <properties>
163                 <skipDockerBuild>false</skipDockerBuild>
164                 <skipDockerTag>false</skipDockerTag>
165                 <skipTests>true</skipTests>
166             </properties>
167             <build>
168                 <plugins>
169
170                     <!-- Setup image tags per https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process#IndependentVersioningandReleaseProcess-StandardizedDockerTagging -->
171                     <plugin>
172                       <groupId>org.codehaus.groovy.maven</groupId>
173                       <artifactId>gmaven-plugin</artifactId>
174                       <executions>
175                           <execution>
176                               <phase>validate</phase>
177                               <goals>
178                                   <goal>execute</goal>
179                               </goals>
180                               <configuration>
181                                   <properties>
182                                       <ver>${project.version}</ver>
183                                       <timestamp>${maven.build.timestamp}</timestamp>
184                                   </properties>
185                                   <source>
186                                       println 'ver: ' + project.properties['ver'];
187                                       if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
188                                           project.properties['dockertag1']=project.properties['ver'] + "-latest";
189                                           project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
190                                       } else {
191                                           project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest";
192                                           project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
193                                       }
194                                       println 'docker tag 1: ' + project.properties['dockertag1'];
195                                       println 'docker tag 2: ' + project.properties['dockertag2'];
196                                   </source>
197                               </configuration>
198                           </execution>
199                       </executions>
200                     </plugin>
201                     <plugin>
202                         <groupId>io.fabric8</groupId>
203                         <artifactId>docker-maven-plugin</artifactId>
204                         <version>0.28.0</version>
205                         <configuration>
206                             <verbose>${docker.verbose}</verbose>
207                             <apiVersion>${docker.apiVersion}</apiVersion>
208                             <pullRegistry>${docker.pull.registry}</pullRegistry>
209                             <pushRegistry>${docker.push.registry}</pushRegistry>
210                             <images>
211                                 <image>
212                                     <name>${datarouter.prov.image.name}</name>
213                                     <build>
214                                         <cleanup>try</cleanup>
215                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
216                                         <dockerFile>Dockerfile</dockerFile>
217                                         <tags>
218                                             <tag>${dockertag1}</tag>
219                                             <tag>${dockertag2}</tag>
220                                         </tags>
221                                     </build>
222                                 </image>
223                             </images>
224                         </configuration>
225                          <executions>
226                              <execution>
227                                  <id>generate-images</id>
228                                  <phase>install</phase>
229                                  <goals>
230                                      <goal>build</goal>
231                                  </goals>
232                              </execution>
233                              <execution>
234                                  <id>push-images</id>
235                                  <phase>deploy</phase>
236                                  <goals>
237                                      <goal>push</goal>
238                                  </goals>
239                              </execution>
240                          </executions>
241                     </plugin>
242                 </plugins>
243             </build>
244         </profile>
245     </profiles>
246     <build>
247         <finalName>datarouter-subscriber</finalName>
248         <resources>
249             <resource>
250                 <directory>src/main/resources</directory>
251                 <filtering>true</filtering>
252                 <includes>
253                     <include>**/*.properties</include>
254                 </includes>
255             </resource>
256             <resource>
257                 <directory>src/main/resources</directory>
258                 <filtering>true</filtering>
259                 <includes>
260                     <include>**/subscriber.properties</include>
261                 </includes>
262             </resource>
263             <resource>
264                 <directory>src/main/resources</directory>
265                 <filtering>true</filtering>
266                 <includes>
267                     <include>**/log4j.properties</include>
268                 </includes>
269             </resource>
270             <resource>
271                 <directory>src/test/resources</directory>
272                 <filtering>true</filtering>
273                 <includes>
274                     <include>**/log4j.properties</include>
275                 </includes>
276             </resource>
277         </resources>
278         <plugins>
279             <plugin>
280                 <artifactId>maven-assembly-plugin</artifactId>
281                 <version>2.4</version>
282                 <configuration>
283                     <descriptorRefs>
284                         <descriptorRef>jar-with-dependencies</descriptorRef>
285                     </descriptorRefs>
286                     <outputDirectory>${basedir}/target/docker-stage/opt/app/subscriber/lib</outputDirectory>
287                     <archive>
288                         <manifest>
289                             <addClasspath>true</addClasspath>
290                             <mainClass>org.onap.dmaap.datarouter.subscriber.SubscriberMain</mainClass>
291                         </manifest>
292                     </archive>
293                 </configuration>
294                 <executions>
295                     <execution>
296                         <id>make-assembly</id>
297                         <!-- this is used for inheritance merges -->
298                         <phase>package</phase>
299                         <!-- bind to the packaging phase -->
300                         <goals>
301                             <goal>single</goal>
302                         </goals>
303                     </execution>
304                 </executions>
305             </plugin>
306             <plugin>
307                 <groupId>org.apache.maven.plugins</groupId>
308                 <artifactId>maven-compiler-plugin</artifactId>
309                 <configuration>
310                     <source>1.8</source>
311                     <target>1.8</target>
312                 </configuration>
313                 <version>3.6.0</version>
314             </plugin>
315             <plugin>
316                 <artifactId>maven-resources-plugin</artifactId>
317                 <version>2.7</version>
318                 <executions>
319                     <execution>
320                         <id>copy-docker-file</id>
321                         <phase>validate</phase>
322                         <goals>
323                             <goal>copy-resources</goal>
324                         </goals>
325                         <configuration>
326                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
327                             <overwrite>true</overwrite>
328                             <resources>
329                                 <resource>
330                                     <directory>${basedir}/src/main/resources/docker</directory>
331                                     <filtering>true</filtering>
332                                     <includes>
333                                         <include>**/*</include>
334                                     </includes>
335                                 </resource>
336                             </resources>
337                         </configuration>
338                     </execution>
339                     <execution>
340                         <id>copy-startup-script</id>
341                         <phase>validate</phase>
342                         <goals>
343                             <goal>copy-resources</goal>
344                         </goals>
345                         <configuration>
346                             <outputDirectory>${basedir}/target/docker-stage/opt</outputDirectory>
347                             <overwrite>true</overwrite>
348                             <resources>
349                                 <resource>
350                                     <directory>${basedir}/src/main/resources/docker</directory>
351                                     <filtering>true</filtering>
352                                     <includes>
353                                         <include>startup.sh</include>
354                                     </includes>
355                                 </resource>
356                             </resources>
357                         </configuration>
358                     </execution>
359                     <execution>
360                         <id>copy-resources-2</id>
361                         <phase>validate</phase>
362                         <goals>
363                             <goal>copy-resources</goal>
364                         </goals>
365                         <configuration>
366                             <outputDirectory>${basedir}/target/docker-stage/opt/app/subscriber/etc</outputDirectory>
367                             <resources>
368                                 <resource>
369                                     <directory>${basedir}/src/main/resources</directory>
370                                     <includes>
371                                         <include>*.properties</include>
372                                     </includes>
373                                 </resource>
374                             </resources>
375                         </configuration>
376                     </execution>
377                 </executions>
378             </plugin>
379             <plugin>
380                 <groupId>org.apache.maven.plugins</groupId>
381                 <artifactId>maven-dependency-plugin</artifactId>
382                 <version>2.10</version>
383                 <executions>
384                     <execution>
385                         <id>copy-dependencies</id>
386                         <phase>package</phase>
387                         <goals>
388                             <goal>copy-dependencies</goal>
389                         </goals>
390                         <configuration>
391                             <outputDirectory>${project.build.directory}/opt/app/subscriber/lib</outputDirectory>
392                             <overWriteReleases>false</overWriteReleases>
393                             <overWriteSnapshots>false</overWriteSnapshots>
394                             <overWriteIfNewer>true</overWriteIfNewer>
395                         </configuration>
396                     </execution>
397                 </executions>
398             </plugin>
399             <plugin>
400                 <groupId>org.apache.maven.plugins</groupId>
401                 <artifactId>maven-source-plugin</artifactId>
402                 <version>2.2.1</version>
403                 <executions>
404                     <execution>
405                         <id>attach-sources</id>
406                         <goals>
407                             <goal>jar-no-fork</goal>
408                         </goals>
409                     </execution>
410                 </executions>
411             </plugin>
412             <plugin>
413                 <groupId>org.jacoco</groupId>
414                 <artifactId>jacoco-maven-plugin</artifactId>
415                 <version>${jacoco.version}</version>
416                 <configuration>
417                     <excludes>
418                         <exclude>**/gen/**</exclude>
419                         <exclude>**/generated-sources/**</exclude>
420                         <exclude>**/yang-gen/**</exclude>
421                         <exclude>**/pax/**</exclude>
422                     </excludes>
423                 </configuration>
424                 <executions>
425                     <execution>
426                         <id>pre-unit-test</id>
427                         <goals>
428                             <goal>prepare-agent</goal>
429                         </goals>
430                         <configuration>
431                             <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
432                             <propertyName>surefireArgLine</propertyName>
433                         </configuration>
434                     </execution>
435                     <execution>
436                         <id>post-unit-test</id>
437                         <phase>test</phase>
438                         <goals>
439                             <goal>report</goal>
440                         </goals>
441                         <configuration>
442                             <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
443                             <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
444                         </configuration>
445                     </execution>
446                     <execution>
447                         <id>pre-integration-test</id>
448                         <phase>pre-integration-test</phase>
449                         <goals>
450                             <goal>prepare-agent</goal>
451                         </goals>
452                         <configuration>
453                             <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
454                             <propertyName>failsafeArgLine</propertyName>
455                         </configuration>
456                     </execution>
457                     <execution>
458                         <id>post-integration-test</id>
459                         <phase>post-integration-test</phase>
460                         <goals>
461                             <goal>report</goal>
462                         </goals>
463                         <configuration>
464                             <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
465                             <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
466                         </configuration>
467                     </execution>
468                 </executions>
469             </plugin>
470         </plugins>
471     </build>
472 </project>