build mutli-platform images
[dmaap/buscontroller.git] / dmaap-bc / pom.xml
1 <?xml version="1.0"?>
2 <!--
3   ============LICENSE_START==========================================
4   org.onap.dmaap
5   ===================================================================
6   Copyright © 2018 AT&T Intellectual Property. 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   ECOMP is a trademark and service mark of AT&T Intellectual Property.
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/maven-v4_0_0.xsd">
24   <modelVersion>4.0.0</modelVersion>
25   <groupId>org.onap.dmaap.buscontroller</groupId>
26   <artifactId>dmaap-bc</artifactId>
27   <version>${artifact.version}</version>
28   <name>dmaap-bc</name>
29   <parent>
30     <groupId>org.onap.oparent</groupId>
31     <artifactId>oparent</artifactId>
32     <version>1.2.2</version>
33     <relativePath/>
34   </parent>
35   <build>
36     <finalName>dmaap-bc</finalName>
37
38     <plugins>
39       <plugin>
40         <groupId>org.apache.maven.plugins</groupId>
41         <artifactId>maven-enforcer-plugin</artifactId>
42         <executions>
43           <execution>
44             <id>enforce-no-snapshots</id>
45             <goals>
46               <goal>enforce</goal>
47             </goals>
48             <configuration>
49               <rules>
50                 <requireReleaseDeps>
51                   <message>No Snapshots Allowed!</message>
52                   <excludes>
53                     <exclude>org.onap.dmaap.dbcapi:dbcapi</exclude>
54                     <exclude>org.onap.aaf.authz:aaf-cadi-client</exclude>
55                     <exclude>org.onap.aaf.authz:aaf-misc-env</exclude>
56                     <exclude>org.onap.aaf.authz:aaf-cadi-aaf</exclude>
57                     <exclude>org.onap.aaf.authz:aaf-auth-client</exclude>
58                     <exclude>org.onap.aaf.authz:aaf-cadi-core</exclude>
59                     <exclude>org.onap.aaf.authz:aaf-misc-rosetta</exclude>
60                   </excludes>
61                 </requireReleaseDeps>
62               </rules>
63               <fail>true</fail>
64             </configuration>
65           </execution>
66         </executions>
67       </plugin>
68
69       <!-- Package an Uber jar -->
70       <plugin>
71         <groupId>org.apache.maven.plugins</groupId>
72         <artifactId>maven-shade-plugin</artifactId>
73         <version>2.4.3</version>
74         <executions>
75           <!-- Run shade goal on package phase -->
76           <execution>
77             <phase>package</phase>
78             <goals>
79               <goal>shade</goal>
80             </goals>
81             <configuration>
82               <createDependencyReducedPom>false</createDependencyReducedPom>
83               <!-- this filter section is needed to avoid runtime error:
84                 java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
85                 suggestion found at: https://stackoverflow.com/q/999489
86               -->
87               <filters>
88                 <filter>
89                   <artifact>*:*</artifact>
90                   <excludes>
91                     <exclude>META-INF/*.SF</exclude>
92                     <exclude>META-INF/*.DSA</exclude>
93                     <exclude>META-INF/*.RSA</exclude>
94                   </excludes>
95                 </filter>
96               </filters>
97               <transformers>
98                 <!-- NOTE: Need the following transformer else gets "Could not resolve type id 'https' into a subtype" error
99                 Solution found from here:
100                 http://stackoverflow.com/questions/27543060/why-does-dropwizard-configuration-is-not-working
101                 Some more context here:
102                 https://github.com/dropwizard/dropwizard/issues/455 -->
103                 <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
104                 <!-- add Main-Class to manifest file -->
105                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
106                   <mainClass>org.onap.dmaap.dbcapi.server.Main</mainClass>
107                 </transformer>
108               </transformers>
109             </configuration>
110           </execution>
111         </executions>
112       </plugin>
113
114       <plugin>
115         <groupId>org.sonatype.plugins</groupId>
116         <artifactId>nexus-staging-maven-plugin</artifactId>
117         <extensions>true</extensions>
118         <configuration>
119           <serverId>ecomp-staging</serverId>
120           <nexusUrl>${nexusproxy}</nexusUrl>
121           <stagingProfileId>176c31dfe190a</stagingProfileId>
122         </configuration>
123       </plugin>
124
125       <!-- for Distribution management -->
126       <plugin>
127         <groupId>org.apache.maven.plugins</groupId>
128         <artifactId>maven-site-plugin</artifactId>
129         <dependencies>
130           <dependency>
131             <groupId>org.apache.maven.wagon</groupId>
132             <artifactId>wagon-webdav-jackrabbit</artifactId>
133             <version>2.10</version>
134           </dependency>
135         </dependencies>
136       </plugin>
137
138     </plugins>
139     <pluginManagement>
140       <plugins>
141         <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
142         <plugin>
143           <groupId>org.eclipse.m2e</groupId>
144           <artifactId>lifecycle-mapping</artifactId>
145           <version>1.0.0</version>
146           <configuration>
147             <lifecycleMappingMetadata>
148               <pluginExecutions>
149                 <pluginExecution>
150                   <pluginExecutionFilter>
151                     <groupId>org.apache.maven.plugins</groupId>
152                     <artifactId>maven-dependency-plugin</artifactId>
153                     <versionRange>[2.10,)</versionRange>
154                     <phase>install</phase>
155                     <goals>
156                       <goal>copy-dependencies</goal>
157                     </goals>
158                   </pluginExecutionFilter>
159                   <action>
160                     <ignore/>
161                   </action>
162                 </pluginExecution>
163               </pluginExecutions>
164             </lifecycleMappingMetadata>
165           </configuration>
166         </plugin>
167       </plugins>
168     </pluginManagement>
169   </build>
170   <profiles>
171       <profile>
172         <id>docker</id>
173         <properties>
174             <skipDockerBuild>false</skipDockerBuild>
175             <skipDockerTag>false</skipDockerTag>
176             <skipTests>true</skipTests>
177         </properties>
178         <build>
179             <!-- Copy files to docker-stage to be included in image -->        
180             <resources>
181                 <resource>
182                     <targetPath>${basedir}/target/docker-stage</targetPath>
183                     <directory>${basedir}/src/main/resources</directory>
184                         <includes>
185                             <include>Dockerfile</include>
186                         </includes>
187                 </resource>
188                  <resource>
189                     <targetPath>${basedir}/target/docker-stage/opt/app/dmaapbc/etc</targetPath>
190                     <directory>${basedir}/misc</directory>
191                         <includes>
192                           <include>LocalKey</include>
193                           <include>logback.xml</include>
194                           <include>org.onap.dmaap-bc.trust.jks</include>
195                           <include>dbc-api.jks</include>
196                         </includes>
197                 </resource>
198                  <resource>
199                     <targetPath>${basedir}/target/docker-stage/opt/app/dmaapbc/etc</targetPath>
200                     <directory>${basedir}</directory>
201                         <includes>
202                             <include>version.properties</include>
203                         </includes>
204                 </resource>
205                  <resource>
206                     <targetPath>${basedir}/target/docker-stage/opt/app/dmaapbc/misc</targetPath>
207                     <directory>${basedir}/misc</directory>
208                         <includes>
209                             <include>opensource.env</include>
210                             <include>*.tmpl</include>
211                         </includes>
212                 </resource>
213                  <resource>
214                     <targetPath>${basedir}/target/docker-stage/opt/app/dmaapbc/misc</targetPath>
215                     <directory>${multiproject.basedir}/misc</directory>
216                         <includes>
217                             <include>cert-client-init.sh</include>
218                         </includes>
219                 </resource>
220                  <resource>
221                     <targetPath>${basedir}/target/docker-stage/opt/app/dmaapbc/bin</targetPath>
222                     <directory>${basedir}/misc</directory>
223                         <includes>
224                             <include>dmaapbc</include>
225                             <include>doaction</include>
226                         </includes>
227                 </resource>
228               </resources>
229             <plugins>
230               <!-- Copy jar to docker-stage to be included in image -->
231               <plugin>
232                     <artifactId>maven-resources-plugin</artifactId>
233                     <version>2.7</version>
234                     <executions>
235                        <execution>
236                             <id>copy-jar</id>
237                             <phase>package</phase>
238                             <goals>
239                                 <goal>copy-resources</goal>
240                             </goals>
241                             <configuration>
242                                 <outputDirectory>${basedir}/target/docker-stage/opt/app/dmaapbc/lib</outputDirectory>
243                                 <resources>
244                                     <resource>
245                                         <directory>${multiproject.basedir}/dmaap-bc/target</directory>
246                                         <includes>
247                                             <include>dmaap-bc.jar</include>
248                                         </includes>
249                                     </resource>
250                                 </resources>
251                             </configuration>
252                         </execution>
253                     </executions>
254                 </plugin>
255
256                 <!-- Setup image tags per https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process#IndependentVersioningandReleaseProcess-StandardizedDockerTagging -->
257                 <plugin>
258                   <groupId>org.codehaus.groovy.maven</groupId>
259                   <artifactId>gmaven-plugin</artifactId>
260                   <executions>
261                       <execution>
262                           <phase>validate</phase>
263                           <goals>
264                               <goal>execute</goal>
265                           </goals>
266                           <configuration>
267                               <properties>
268                                   <ver>${project.version}</ver>
269                                   <timestamp>${maven.build.timestamp}</timestamp>
270                               </properties>
271                               <source>
272                                   println 'ver: ' + project.properties['ver'];
273                                   if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
274                                       project.properties['dockertag1']=project.properties['ver'] + "-latest";
275                                       project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
276                                   } else {
277                                       project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest";
278                                       project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
279                                   }
280                                   println 'docker tag 1: ' + project.properties['dockertag1'];
281                                   println 'docker tag 2: ' + project.properties['dockertag2'];
282                               </source>
283                           </configuration>
284                       </execution>
285                   </executions>
286                 </plugin>
287
288                <plugin>
289                     <groupId>io.fabric8</groupId>
290                     <artifactId>docker-maven-plugin</artifactId>
291                     <version>0.28.0</version>  
292                     <configuration>
293                         <verbose>${docker.verbose}</verbose>
294                         <apiVersion>${docker.apiVersion}</apiVersion>
295                         <pullRegistry>${docker.pull.registry}</pullRegistry>
296                         <pushRegistry>${docker.push.registry}</pushRegistry>
297                         <images>
298                             <image>                            
299                                 <name>${docker.image}</name>
300                                 <build>
301                                     <cleanup>try</cleanup>
302                                     <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
303                                     <dockerFile>Dockerfile</dockerFile>
304                                     <tags>
305                                         <tag>${dockertag1}</tag>
306                                         <tag>${dockertag2}</tag>
307                                     </tags>
308                                 </build>
309                             </image>
310                         </images>
311                     </configuration>
312                      <executions>
313                          <execution>
314                              <id>generate-images</id>
315                              <phase>install</phase>
316                              <goals>
317                                  <goal>build</goal>
318                              </goals>
319                          </execution>
320                          <execution>
321                              <id>push-images</id>
322                              <phase>deploy</phase>
323                              <goals>
324                                  <goal>push</goal>
325                              </goals>
326                          </execution>
327                      </executions>
328                 </plugin>
329             </plugins>
330         </build>
331     </profile>
332   </profiles>
333   <dependencyManagement>
334     <dependencies>
335       <dependency>
336         <groupId>org.glassfish.jersey</groupId>
337         <artifactId>jersey-bom</artifactId>
338         <version>${jersey.version}</version>
339         <type>pom</type>
340         <scope>import</scope>
341       </dependency>
342     </dependencies>
343   </dependencyManagement>
344   <dependencies>
345     <dependency>
346       <groupId>io.swagger</groupId>
347       <artifactId>swagger-core</artifactId>
348       <version>${swagger.version}</version>
349     </dependency>
350     <dependency>
351       <groupId>io.swagger</groupId>
352       <artifactId>swagger-jersey2-jaxrs</artifactId>
353       <version>${swagger.version}</version>
354     </dependency>
355     <dependency>
356       <groupId>io.swagger</groupId>
357       <artifactId>swagger-annotations</artifactId>
358       <version>${swagger.version}</version>
359     </dependency>
360     <dependency>
361       <groupId>org.glassfish.jersey.containers</groupId>
362       <artifactId>jersey-container-servlet-core</artifactId>
363       <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
364       <!-- artifactId>jersey-container-servlet</artifactId -->
365     </dependency>
366     <dependency>
367       <groupId>org.glassfish.jersey.media</groupId>
368       <artifactId>jersey-media-moxy</artifactId>
369     </dependency>
370     <dependency>
371       <groupId>log4j</groupId>
372       <artifactId>log4j</artifactId>
373       <version>1.2.17</version>
374     </dependency>
375     <dependency>
376       <groupId>org.eclipse.jetty</groupId>
377       <artifactId>jetty-server</artifactId>
378       <version>${jettyVersion}</version>
379     </dependency>
380     <dependency>
381       <groupId>org.onap.aaf.authz</groupId>
382       <artifactId>aaf-cadi-aaf</artifactId>
383       <version>2.1.7</version>
384       <classifier>full</classifier>
385     </dependency>
386
387     <dependency>
388       <groupId>org.eclipse.jetty</groupId>
389       <artifactId>jetty-servlet</artifactId>
390       <version>${jettyVersion}</version>
391       <scope>compile</scope>
392     </dependency>
393     <dependency>
394       <groupId>org.eclipse.jetty</groupId>
395       <artifactId>jetty-servlets</artifactId>
396       <version>${jettyVersion}</version>
397       <scope>compile</scope>
398     </dependency>
399     <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
400     <dependency>
401       <groupId>com.googlecode.json-simple</groupId>
402       <artifactId>json-simple</artifactId>
403       <version>1.1.1</version>
404     </dependency>
405     <dependency>
406       <groupId>commons-codec</groupId>
407       <artifactId>commons-codec</artifactId>
408       <version>1.11</version>
409     </dependency>
410     <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
411     <dependency>
412       <groupId>org.postgresql</groupId>
413       <artifactId>postgresql</artifactId>
414       <version>42.2.5</version>
415     </dependency>
416
417     <dependency>
418       <groupId>org.onap.dmaap.dbcapi</groupId>
419       <artifactId>dbcapi</artifactId>
420       <version>1.0.23-SNAPSHOT</version>
421     </dependency>
422   </dependencies>
423   <reporting>
424     <plugins>
425       <plugin>
426         <groupId>org.apache.maven.plugins</groupId>
427         <artifactId>maven-javadoc-plugin</artifactId>
428         <version>2.10.4</version>
429         <configuration>
430           <failOnError>false</failOnError>
431           <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
432           <docletArtifact>
433             <groupId>org.umlgraph</groupId>
434             <artifactId>umlgraph</artifactId>
435             <version>5.6</version>
436           </docletArtifact>
437           <additionalparam>-views</additionalparam>
438           <useStandardDocletOptions>true</useStandardDocletOptions>
439         </configuration>
440       </plugin>
441     </plugins>
442   </reporting>
443
444   <distributionManagement>
445     <site>
446       <id>ecomp-site</id>
447       <url>dav:${nexusproxy}${sitePath}</url>
448     </site>
449   </distributionManagement>
450   <properties>
451     <multiproject.basedir>${basedir}/..</multiproject.basedir>
452     <docker.maven.plugin.version>1.0.0</docker.maven.plugin.version>
453     <jersey.version>2.16</jersey.version>
454     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
455     <jettyVersion>9.4.12.RC2</jettyVersion>
456     <eelf.version>1.0.0</eelf.version>
457     <swagger.version>1.5.19</swagger.version>
458     <artifact.version>1.1.1</artifact.version>
459     <!--  SONAR  -->
460     <jacoco.version>0.7.7.201606060606</jacoco.version>
461     <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
462     <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
463     <!-- Default Sonar configuration -->
464     <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
465     <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
466     <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->
467     <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>
468
469     <!-- docker image -->
470     <docker.image>onap/dmaap/dmaap-bc</docker.image>
471
472     <nexusproxy>https://nexus.onap.org</nexusproxy>
473     <docker.push.registry>10.12.5.45:5000</docker.push.registry>
474
475     <timestamp>${maven.build.timestamp}</timestamp>
476     <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
477
478     <!-- for Distribution Management -->
479     <sitePath>/content/sites/site/org/onap/dmaap/dmaap-bc/${artifact.version}</sitePath>
480   </properties>
481   <description>Packaging Platform (DMaaP) Bus Controller API as a Docker container.</description>
482 </project>