fix maven-dockera-stage build error
[msb/discovery.git] / distributions / msb-discovery / pom.xml
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!--
3
4     Copyright 2016-2017 ZTE, Inc. and others.
5
6     Licensed under the Apache License, Version 2.0 (the "License");
7     you may not use this file except in compliance with the License.
8     You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12     Unless required by applicable law or agreed to in writing, software
13     distributed under the License is distributed on an "AS IS" BASIS,
14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15     See the License for the specific language governing permissions and
16     limitations under the License.
17
18 -->
19 <project xmlns="http://maven.apache.org/POM/4.0.0" 
20   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21   <parent>
22     <groupId>org.onap.msb.discovery.distributions</groupId>
23     <artifactId>distributions-parent</artifactId>
24     <version>1.2.5-SNAPSHOT</version>
25   </parent>
26   <modelVersion>4.0.0</modelVersion>
27   <groupId>org.onap.msb.discovery.distributions</groupId>
28   <artifactId>msb-discovery</artifactId>
29   <version>1.2.5-SNAPSHOT</version>
30   <name>onap/msb/discovery/distributions/msb-discovery</name>
31   <packaging>pom</packaging>
32
33   <properties>
34
35     <openresty.version>1.11.2.2</openresty.version>
36     <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
37     <packageid>msb-discovery</packageid>
38     <html.dir>openresty/nginx/html</html.dir>
39     <version.output>${project.basedir}/target/version</version.output>
40     <docker.image.name>onap/msb/msb_discovery</docker.image.name>
41     <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag>
42     <docker.latest.tag>${project.version}-latest</docker.latest.tag>
43   </properties>
44
45   <profiles>
46     <profile>
47       <id>linux</id>
48       <activation>
49         <activeByDefault>true</activeByDefault>
50       </activation>
51       <dependencies>
52         <dependency>
53           <groupId>org.onap.msb.discovery</groupId>
54           <artifactId>nginx-ext-consul</artifactId>
55           <type>zip</type>
56           <version>${project.version}</version>
57           <optional>true</optional>
58         </dependency>
59         <dependency>
60           <groupId>org.onap.msb.discovery.sdclient</groupId>
61           <artifactId>discovery-standalone</artifactId>
62           <type>zip</type>
63           <version>${project.version}</version>
64           <optional>true</optional>
65         </dependency>
66
67       </dependencies>
68
69
70       <build>
71         <plugins>
72           <plugin>
73             <artifactId>maven-resources-plugin</artifactId>
74             <executions>
75               <execution>
76                 <id>copy-resources-dockerfile</id>
77                 <phase>process-resources</phase>
78                 <goals>
79                   <goal>copy-resources</goal>
80                 </goals>
81                 <configuration>
82                   <outputDirectory>${version.output}</outputDirectory>
83                   <includeEmptyDirs>true</includeEmptyDirs>
84                   <resources>
85                     <resource>
86                       <directory>${dockerFileDir}</directory>
87                       <filtering>false</filtering>
88                       <includes>
89                         <include>**/*</include>
90                       </includes>
91                     </resource>
92                   </resources>
93                   <overwrite>true</overwrite>
94                 </configuration>
95               </execution>
96
97               <execution>
98                 <id>copy-resources-linux64</id>
99                 <phase>process-resources</phase>
100                 <goals>
101                   <goal>copy-resources</goal>
102                 </goals>
103                 <configuration>
104                   <outputDirectory>${linux64outputdir}</outputDirectory>
105                   <includeEmptyDirs>true</includeEmptyDirs>
106                   <resources>
107                     <resource>
108                       <directory>src/assembly/resources</directory>
109                       <filtering>false</filtering>
110                       <includes>
111                         <include>**/*</include>
112                       </includes>
113                       <excludes>
114                         <exclude>**/*.bat</exclude>
115                       </excludes>
116                     </resource>
117                   </resources>
118                   <overwrite>true</overwrite>
119                 </configuration>
120               </execution>
121             </executions>
122           </plugin>
123           <plugin>
124             <groupId>org.apache.maven.plugins</groupId>
125             <artifactId>maven-dependency-plugin</artifactId>
126             <executions>
127               <execution>
128                 <id>unpacktolinux64</id>
129                 <goals>
130                   <goal>unpack</goal>
131                 </goals>
132                 <phase>prepare-package</phase>
133                 <configuration>
134                   <artifactItems>
135                     <artifactItem>
136                       <groupId>org.onap.msb.discovery</groupId>
137                       <artifactId>nginx-ext-consul</artifactId>
138                       <type>zip</type>
139                     </artifactItem>
140                     <artifactItem>
141                       <groupId>org.onap.msb.discovery.sdclient</groupId>
142                       <artifactId>discovery-standalone</artifactId>
143                       <type>zip</type>
144                     </artifactItem>
145                   </artifactItems>
146                   <excludes>**/*.bat,*.cmd,META-INF/**</excludes>
147                   <outputDirectory>${linux64outputdir}</outputDirectory>
148                   <overWriteReleases>false</overWriteReleases>
149                   <overWriteSnapshots>true</overWriteSnapshots>
150                   <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
151                 </configuration>
152               </execution>
153             </executions>
154           </plugin>
155           <plugin>
156             <groupId>org.apache.maven.plugins</groupId>
157             <artifactId>maven-antrun-plugin</artifactId>
158             <executions>
159               <execution>
160                 <id>distribution</id>
161                 <phase>package</phase>
162                 <goals>
163                   <goal>run</goal>
164                 </goals>
165                 <configuration>
166                   <target name="distribution">
167                     <tar destfile="${version.output}/${packageid}-${project.version}-${classifier.linux64}.tar.gz" longfile="posix" compression="gzip">
168                       <tarfileset dir="${linux64outputdir}" prefix="${packageid}" filemode="0644" dirmode="0755">
169                         <exclude name="**/*.sh"/>
170                         <exclude name="openresty/nginx/sbin/nginx"/>
171                       </tarfileset>
172                       <tarfileset dir="${linux64outputdir}" prefix="${packageid}" filemode="0755" dirmode="0755">
173                         <include name="**/*.sh"/>
174                         <include name="openresty/nginx/sbin/nginx"/>
175                       </tarfileset>
176                     </tar>
177                   </target>
178                 </configuration>
179               </execution>
180             </executions>
181           </plugin>
182         </plugins>
183       </build>
184     </profile>
185     <profile>
186       <id>docker</id>
187       <build>
188         <plugins>
189           <plugin>
190             <groupId>io.fabric8</groupId>
191             <artifactId>docker-maven-plugin</artifactId>
192             <version>0.19.1</version>
193             <dependencies>
194               <dependency>
195                 <groupId>com.github.jnr</groupId>
196                 <artifactId>jnr-unixsocket</artifactId>
197                 <version>0.13</version>
198               </dependency>
199             </dependencies>
200             <configuration>
201               <verbose>true</verbose>
202               <apiVersion>1.23</apiVersion>
203               <registry>nexus3.onap.org:10003</registry>
204               <images>
205                 <image>
206                   <name>${docker.image.name}</name>
207                   <alias>docker_msb_discovery</alias>
208                   <build>
209                     <cleanup>true</cleanup>
210                     <tags>
211                       <tag>${docker.tag}</tag>
212                       <tag>${docker.latest.tag}</tag>
213                     </tags>
214                     <dockerFileDir>${version.output}</dockerFileDir>
215                     <!--assembly>
216                         <descriptorRef>artifact</descriptorRef>
217                     </assembly-->
218                   </build>
219                 </image>
220               </images>
221             </configuration>
222             <executions>
223               <execution>
224                 <id>clean-images</id>
225                 <phase>pre-clean</phase>
226                 <goals>
227                   <goal>remove</goal>
228                 </goals>
229                 <configuration>
230                   <removeAll>true</removeAll>
231                   <image>docker_msb_discovery</image>
232                 </configuration>
233               </execution>
234               <execution>
235                 <id>generate-images</id>
236                 <phase>package</phase>
237                 <goals>
238                   <goal>build</goal>
239                 </goals>
240               </execution>
241               <execution>
242                 <id>push-images</id>
243                 <phase>deploy</phase>
244                 <goals>
245                   <goal>push</goal>
246                 </goals>
247                 <configuration>
248                   <image>${docker.image.name}</image>
249                 </configuration>
250               </execution>
251             </executions>
252           </plugin>
253         </plugins>
254       </build>
255     </profile>
256   </profiles>
257 </project>
258