[SDNC-7] Update SDNC Image - Use dependency plugin
[sdnc/oam.git] / installation / sdnc / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
5         <parent>
6                 <groupId>org.openecomp.sdnc.oam</groupId>
7                 <artifactId>installation</artifactId>
8                 <version>1.1.1-SNAPSHOT</version>
9         </parent>
10
11         <modelVersion>4.0.0</modelVersion>
12         <packaging>pom</packaging>
13         <groupId>org.openecomp.sdnc.oam</groupId>
14         <artifactId>installation-sdnc</artifactId>
15         <version>1.1.1-SNAPSHOT</version>
16
17         <name>Installation - sdnc</name>
18         <description>Creates SDN Controller Docker container</description>
19
20         <properties>
21                 <image.name>openecomp/sdnc-image</image.name>
22                 <sdnc.project.version>${project.version}</sdnc.project.version>
23                 <sdnc.core.version>${project.version}</sdnc.core.version>
24                 <sdnc.adaptors.version>${project.version}</sdnc.adaptors.version>
25                 <sdnc.northbound.version>${project.version}</sdnc.northbound.version>
26                 <sdnc.plugins.version>${project.version}</sdnc.plugins.version>
27                 <sdnc.opendaylight.version>0.5.1-Boron-SR1</sdnc.opendaylight.version>
28                 <sdnc.mysql-connector-java.version>5.1.39</sdnc.mysql-connector-java.version>
29                 <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
30         </properties>
31
32         <dependencyManagement>
33                 <dependencies>
34                         <dependency>
35                                 <groupId>org.opendaylight.integration</groupId>
36                                 <artifactId>distribution-karaf</artifactId>
37                                 <version>${sdnc.opendaylight.version}</version>
38                                 <type>tar.gz</type>
39                         </dependency>
40                         <dependency>
41                                 <groupId>mysql</groupId>
42                                 <artifactId>mysql-connector-java</artifactId>
43                                 <version>${sdnc.mysql-connector-java.version}</version>
44                                 <type>jar</type>
45                         </dependency>
46                 </dependencies>
47         </dependencyManagement>
48
49         <build>
50                 <plugins>
51
52
53                         <plugin>
54                                 <groupId>org.codehaus.groovy.maven</groupId>
55                                 <artifactId>gmaven-plugin</artifactId>
56                                 <executions>
57                                         <execution>
58                                                 <phase>validate</phase>
59                                                 <goals>
60                                                         <goal>execute</goal>
61                                                 </goals>
62                                                 <configuration>
63                                                         <source>
64                                                                 println project.properties['sdnc.project.version'];
65                                                                 def versionArray;
66                                                                 if ( project.properties['sdnc.project.version'] != null ) {
67                                                                         versionArray =
68                                                                         project.properties['sdnc.project.version'].split('\\.');
69                                                                 }
70
71                                                                 if (project.properties['sdnc.project.version'].endsWith("-SNAPSHOT")) {
72                                                                         project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
73                                                                 } else {
74                                                                         project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
75                                                                 }
76
77                                                                 println 'New Tag for docker:' +
78                                                                 project.properties['project.docker.latesttag.version'];
79                                                         </source>
80                                                 </configuration>
81                                         </execution>
82                                 </executions>
83                         </plugin>
84
85                         <plugin>
86                                 <groupId>io.fabric8</groupId>
87                                 <artifactId>docker-maven-plugin</artifactId>
88                                 <version>0.16.5</version>
89                                 <inherited>false</inherited>
90                                 <configuration>
91                                         <images>
92                                                 <image>
93                                                         <name>${image.name}</name>
94                                                         <build>
95                                                                 <cleanup>try</cleanup>
96                                                                 <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
97                                                                 <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
98                                                                 <tags>
99                                                                         <tag>${project.version}</tag>
100                                                                         <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
101                                                                         <tag>${project.docker.latesttag.version}</tag>
102                                                                 </tags>
103                                                         </build>
104                                                 </image>
105                                         </images>
106                                 </configuration>
107                                 <executions>
108                                         <execution>
109                                                 <id>generate-images</id>
110                                                 <phase>package</phase>
111                                                 <goals>
112                                                         <goal>build</goal>
113                                                 </goals>
114                                         </execution>
115
116                                         <execution>
117                                                 <id>push-images</id>
118                                                 <phase>deploy</phase>
119                                                 <goals>
120                                                         <goal>build</goal>
121                                                         <goal>push</goal>
122                                                 </goals>
123                                         </execution>
124                                 </executions>
125                         </plugin>
126
127
128                         <plugin>
129                         <groupId>org.apache.maven.plugins</groupId>
130                         <artifactId>maven-dependency-plugin</artifactId>
131                         <version>3.0.0</version>
132                         <executions>
133                                 <execution>
134                                         <id>get-odl-distribution</id>
135                                         <phase>validate</phase>
136                                         <goals>
137                                                 <goal>copy</goal>
138                                         </goals>
139                                         <configuration>
140                                                 <artifactItems>
141                                                         <artifactItem>
142                                                                 <groupId>org.opendaylight.integration</groupId>
143                                                                 <artifactId>distribution-karaf</artifactId>
144                                                                 <version>${sdnc.opendaylight.version}</version>
145                                                                 <type>tar.gz</type>
146
147                                                                 <overWrite>true</overWrite>
148                                                                 <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
149                                                         </artifactItem>
150                                                 </artifactItems>
151                                                 <overWriteReleases>false</overWriteReleases>
152                                                 <overWriteSnapshots>true</overWriteSnapshots>
153                                                 <overWriteIfNewer>true</overWriteIfNewer>
154                                         </configuration>
155                                 </execution>
156                         </executions>
157                         </plugin>
158
159                         <plugin>
160                                 <groupId>org.apache.maven.plugins</groupId>
161                                 <artifactId>maven-dependency-plugin</artifactId>
162                                 <version>3.0.0</version>
163                                 <executions>
164                                         <execution>
165                                                 <id>get-mysql-connector-jar</id>
166                                                 <phase>validate</phase>
167                                                 <goals>
168                                                         <goal>copy</goal>
169                                                 </goals>
170                                                 <configuration>
171                                                         <artifactItems>
172                                                                 <artifactItem>
173                                                                         <groupId>mysql</groupId>
174                                                                         <artifactId>mysql-connector-java</artifactId>
175                                                                         <version>${sdnc.mysql-connector-java.version}</version>
176                                                                         <type>jar</type>
177
178                                                                         <overWrite>true</overWrite>
179                                                                         <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
180                                                                 </artifactItem>
181                                                         </artifactItems>
182                                                         <overWriteReleases>false</overWriteReleases>
183                                                         <overWriteSnapshots>true</overWriteSnapshots>
184                                                         <overWriteIfNewer>true</overWriteIfNewer>
185                                                 </configuration>
186                                         </execution>
187                                 </executions>
188                         </plugin>
189
190                         <plugin>
191                                 <artifactId>maven-resources-plugin</artifactId>
192                                 <version>2.6</version>
193                                 <executions>
194                                         <execution>
195                                                 <id>copy-dockerfile</id>
196                                                 <goals>
197                                                         <goal>copy-resources</goal>
198                                                 </goals><!-- here the phase you need -->
199                                                 <phase>validate</phase>
200                                                 <configuration>
201                                                         <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
202                                                         <resources>
203                                                                 <resource>
204                                                                         <directory>src/main/docker</directory>
205                                                                         <includes>
206                                                                                 <include>Dockerfile</include>
207                                                                         </includes>
208                                                                         <filtering>true</filtering>
209                                                                 </resource>
210                                                         </resources>
211                                                 </configuration>
212                                         </execution>
213
214                                         <execution>
215                                                 <id>copy-scripts</id>
216                                                 <goals>
217                                                         <goal>copy-resources</goal>
218                                                 </goals><!-- here the phase you need -->
219                                                 <phase>validate</phase>
220                                                 <configuration>
221                                                         <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/sdnc/bin</outputDirectory>
222                                                         <resources>
223                                                                 <resource>
224                                                                         <directory>src/main/scripts</directory>
225                                                                         <includes>
226                                                                                 <include>*.sh</include>
227                                                                         </includes>
228                                                                         <filtering>false</filtering>
229                                                                 </resource>
230                                                         </resources>
231                                                 </configuration>
232                                         </execution>
233
234                                         <execution>
235                                                 <id>copy-tarballs</id>
236                                                 <goals>
237                                                         <goal>copy-resources</goal>
238                                                 </goals><!-- here the phase you need -->
239                                                 <phase>validate</phase>
240                                                 <configuration>
241                                                         <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
242                                                         <resources>
243                                                                 <resource>
244                                                                         <directory>src/main/resources</directory>
245                                                                         <includes>
246                                                                                 <include>idmlight.db.mv.db</include>
247                                                                         </includes>
248                                                                         <filtering>false</filtering>
249                                                                 </resource>
250                                                         </resources>
251                                                 </configuration>
252                                         </execution>
253                                         <execution>
254                                                 <id>copy-data</id>
255                                                 <goals>
256                                                         <goal>copy-resources</goal>
257                                                 </goals><!-- here the phase you need -->
258                                                 <phase>validate</phase>
259                                                 <configuration>
260                                                         <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/sdnc/data</outputDirectory>
261                                                         <resources>
262                                                                 <resource>
263                                                                         <directory>src/main/resources</directory>
264                                                                         <includes>
265                                                                                 <include>*.dump</include>
266                                                                         </includes>
267                                                                         <filtering>false</filtering>
268                                                                 </resource>
269                                                         </resources>
270                                                 </configuration>
271                                         </execution>
272                                         <execution>
273                                                 <id>copy-properties</id>
274                                                 <goals>
275                                                         <goal>copy-resources</goal>
276                                                 </goals><!-- here the phase you need -->
277                                                 <phase>validate</phase>
278                                                 <configuration>
279                                                         <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/sdnc/data/properties</outputDirectory>
280                                                         <resources>
281                                                                 <resource>
282                                                                         <directory>../src/main/properties</directory>
283                                                                         <includes>
284                                                                                 <include>*.properties</include>
285                                                                         </includes>
286                                                                         <filtering>false</filtering>
287                                                                 </resource>
288                                                         </resources>
289                                                 </configuration>
290                                         </execution>
291                                         <execution>
292                                                 <id>copy-keystores</id>
293                                                 <goals>
294                                                         <goal>copy-resources</goal>
295                                                 </goals><!-- here the phase you need -->
296                                                 <phase>validate</phase>
297                                                 <configuration>
298                                                         <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/sdnc/data/stores</outputDirectory>
299                                                         <resources>
300                                                                 <resource>
301                                                                         <directory>../src/main/stores</directory>
302                                                                         <includes>
303                                                                                 <include>*.jks</include>
304                                                                         </includes>
305                                                                         <filtering>false</filtering>
306                                                                 </resource>
307                                                         </resources>
308                                                 </configuration>
309                                         </execution>
310                                 </executions>
311                         </plugin>
312                         <plugin>
313                                 <artifactId>exec-maven-plugin</artifactId>
314                                 <groupId>org.codehaus.mojo</groupId>
315                                 <version>1.5.0</version>
316                                 <executions>
317
318                                         <execution>
319                                                 <id>Get features</id>
320                                                 <phase>generate-sources</phase>
321                                                 <goals>
322                                                         <goal>exec</goal>
323                                                 </goals>
324                                                 <configuration>
325                                                         <executable>/bin/bash</executable>
326                                                         <environmentVariables>
327                                                                 <SDNC_CORE_VERSION>${sdnc.core.version}</SDNC_CORE_VERSION>
328                                                                 <SDNC_ADAPTORS_VERSION>${sdnc.adaptors.version}</SDNC_ADAPTORS_VERSION>
329                                                                 <SDNC_NORTHBOUND_VERSION>${sdnc.northbound.version}</SDNC_NORTHBOUND_VERSION>
330                                                                 <SDNC_PLUGINS_VERSION>${sdnc.plugins.version}</SDNC_PLUGINS_VERSION>
331                                                                 <SDNC_OAM_VERSION>${project.version}</SDNC_OAM_VERSION>
332                                                         </environmentVariables>
333                                                         <arguments>
334                                                                 <argument>${basedir}/src/main/scripts/installZips.sh</argument>
335                                                                 <argument>${basedir}/target/docker-stage/opt/openecomp/sdnc</argument>
336                                                         </arguments>
337                                                 </configuration>
338                                         </execution>
339
340                                         <execution>
341                                                 <id>change shell permissions</id>
342                                                 <phase>process-sources</phase>
343                                                 <goals>
344                                                         <goal>exec</goal>
345                                                 </goals>
346                                                 <configuration>
347                                                         <executable>/usr/bin/find</executable>
348                                                         <arguments>
349                                                                 <argument>${basedir}/target/docker-stage/opt/openecomp/sdnc</argument>
350                                                                 <argument>-name</argument>
351                                                                 <argument>*.sh</argument>
352                                                                 <argument>-exec</argument>
353                                                                 <argument>chmod</argument>
354                                                                 <argument>+x</argument>
355                                                                 <argument>{}</argument>
356                                                                 <argument>;</argument>
357                                                         </arguments>
358                                                 </configuration>
359                                         </execution>
360                                 </executions>
361                         </plugin>
362
363
364                 </plugins>
365
366         </build>
367         <organization>
368                 <name>openECOMP</name>
369         </organization>
370 </project>