Use docker profile
[ccsdk/distribution.git] / opendaylight / 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.onap.ccsdk.distribution</groupId>
7         <artifactId>distribution-root</artifactId>
8         <version>0.1.0-SNAPSHOT</version>
9     </parent>
10
11     <modelVersion>4.0.0</modelVersion>
12     <packaging>pom</packaging>
13     <artifactId>distribution-opendaylight</artifactId>
14     <version>0.1.0-SNAPSHOT</version>
15
16     <name>Distribution - opendaylight</name>
17     <description>Creates OpenDaylight container</description>
18
19     <properties>
20         <image.name>onap/ccsdk-odl-image</image.name>
21         <ccsdk.project.version>${project.version}</ccsdk.project.version>
22         <ccsdk.opendaylight.version>0.6.1-Carbon</ccsdk.opendaylight.version>
23         <ccsdk.mysql-connector-java.version>5.1.39</ccsdk.mysql-connector-java.version>
24         <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
25     </properties>
26
27     <dependencyManagement>
28         <dependencies>
29             <dependency>
30                 <groupId>org.opendaylight.integration</groupId>
31                 <artifactId>distribution-karaf</artifactId>
32                 <version>${ccsdk.opendaylight.version}</version>
33                 <type>tar.gz</type>
34             </dependency>
35             <dependency>
36                 <groupId>mysql</groupId>
37                 <artifactId>mysql-connector-java</artifactId>
38                 <version>${ccsdk.mysql-connector-java.version}</version>
39                 <type>jar</type>
40             </dependency>
41         </dependencies>
42     </dependencyManagement>
43
44     <build>
45         <plugins>
46
47
48             <plugin>
49                 <groupId>org.codehaus.groovy.maven</groupId>
50                 <artifactId>gmaven-plugin</artifactId>
51                 <executions>
52                     <execution>
53                         <phase>validate</phase>
54                         <goals>
55                             <goal>execute</goal>
56                         </goals>
57                         <configuration>
58                             <source>
59                                 println project.properties['ccsdk.project.version'];
60                                 def versionArray;
61                                 if (project.properties['ccsdk.project.version'] != null ) {
62                                     versionArray = project.properties['ccsdk.project.version'].split('\\.');
63                                 }
64
65                                 if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
66                                 {
67                                     project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
68                                 } else {
69                                     project.properties['project.docker.latesttag.version']=versionArray[0]+ '.' + versionArray[1] +"-STAGING-latest";
70                                 }
71
72                                 println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
73                             </source>
74                         </configuration>
75                     </execution>
76                 </executions>
77             </plugin>
78
79
80
81             <plugin>
82                 <groupId>org.apache.maven.plugins</groupId>
83                 <artifactId>maven-dependency-plugin</artifactId>
84                 <version>3.0.0</version>
85                 <executions>
86                     <execution>
87                         <id>get-odl-distribution</id>
88                         <phase>validate</phase>
89                         <goals>
90                             <goal>copy</goal>
91                         </goals>
92                         <configuration>
93                             <artifactItems>
94                                 <artifactItem>
95                                     <groupId>org.opendaylight.integration</groupId>
96                                     <artifactId>distribution-karaf</artifactId>
97                                     <version>${ccsdk.opendaylight.version}</version>
98                                     <type>tar.gz</type>
99
100                                     <overWrite>true</overWrite>
101                                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
102                                 </artifactItem>
103                             </artifactItems>
104                             <overWriteReleases>false</overWriteReleases>
105                             <overWriteSnapshots>true</overWriteSnapshots>
106                             <overWriteIfNewer>true</overWriteIfNewer>
107                         </configuration>
108                     </execution>
109                 </executions>
110             </plugin>
111
112             <plugin>
113                 <groupId>org.apache.maven.plugins</groupId>
114                 <artifactId>maven-dependency-plugin</artifactId>
115                 <version>3.0.0</version>
116                 <executions>
117                     <execution>
118                         <id>get-mysql-connector-jar</id>
119                         <phase>validate</phase>
120                         <goals>
121                             <goal>copy</goal>
122                         </goals>
123                         <configuration>
124                             <artifactItems>
125                                 <artifactItem>
126                                     <groupId>mysql</groupId>
127                                     <artifactId>mysql-connector-java</artifactId>
128                                     <version>${ccsdk.mysql-connector-java.version}</version>
129                                     <type>jar</type>
130
131                                     <overWrite>true</overWrite>
132                                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
133                                 </artifactItem>
134                             </artifactItems>
135                             <overWriteReleases>false</overWriteReleases>
136                             <overWriteSnapshots>true</overWriteSnapshots>
137                             <overWriteIfNewer>true</overWriteIfNewer>
138                         </configuration>
139                     </execution>
140                 </executions>
141             </plugin>
142
143             <plugin>
144                 <artifactId>maven-resources-plugin</artifactId>
145                 <version>2.6</version>
146                 <executions>
147                     <execution>
148                         <id>copy-dockerfile</id>
149                         <goals>
150                             <goal>copy-resources</goal>
151                         </goals><!-- here the phase you need -->
152                         <phase>validate</phase>
153                         <configuration>
154                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
155                             <resources>
156                                 <resource>
157                                     <directory>src/main/docker</directory>
158                                     <includes>
159                                         <include>Dockerfile</include>
160                                     </includes>
161                                     <filtering>true</filtering>
162                                 </resource>
163                             </resources>
164                         </configuration>
165                     </execution>
166                 </executions>
167             </plugin>
168
169
170
171         </plugins>
172
173     </build>
174
175     <profiles>
176         <profile>
177             <id>docker</id>
178             <build>
179                 <plugins>
180                     <plugin>
181                         <groupId>io.fabric8</groupId>
182                         <artifactId>docker-maven-plugin</artifactId>
183                         <version>0.16.5</version>
184                         <inherited>false</inherited>
185                         <configuration>
186                             <images>
187                                 <image>
188                                     <name>${image.name}</name>
189                                     <build>
190                                         <cleanup>try</cleanup>
191                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
192                                         <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
193                                         <tags>
194                                             <tag>${project.version}</tag>
195                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
196                                             <tag>${project.docker.latesttag.version}</tag>
197                                         </tags>
198                                     </build>
199                                 </image>
200                             </images>
201                         </configuration>
202                         <executions>
203                             <execution>
204                                 <id>generate-images</id>
205                                 <phase>package</phase>
206                                 <goals>
207                                     <goal>build</goal>
208                                 </goals>
209                             </execution>
210
211                             <execution>
212                                 <id>push-images</id>
213                                 <phase>deploy</phase>
214                                 <goals>
215                                     <goal>build</goal>
216                                     <goal>push</goal>
217                                 </goals>
218                             </execution>
219                         </executions>
220                     </plugin>
221
222                 </plugins>
223             </build>
224         </profile>
225
226     </profiles>
227     <organization>
228         <name>openECOMP</name>
229     </organization>
230 </project>