1061bbb70e3c3d617f0190cd2fbd8342a01c3174
[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.mariadb-connector-java.version>2.1.1</ccsdk.mariadb-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>org.mariadb.jdbc</groupId>
37                 <artifactId>mariadb-java-client</artifactId>
38                 <version>${ccsdk.mariadb-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-mariadb-connector-jar</id>
119                         <phase>validate</phase>
120                         <goals>
121                             <goal>copy</goal>
122                         </goals>
123                         <configuration>
124                             <artifactItems>
125                                 <artifactItem>
126                                     <groupId>org.mariadb.jdbc</groupId>
127                                     <artifactId>mariadb-java-client</artifactId>
128                                     <version>${ccsdk.mariadb-connector-java.version}</version>
129                                     <type>jar</type>
130                                     <overWrite>true</overWrite>
131                                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
132                                 </artifactItem>
133                             </artifactItems>
134                             <overWriteReleases>false</overWriteReleases>
135                             <overWriteSnapshots>true</overWriteSnapshots>
136                             <overWriteIfNewer>true</overWriteIfNewer>
137                         </configuration>
138                     </execution>
139                 </executions>
140             </plugin>
141
142             <plugin>
143                 <artifactId>maven-resources-plugin</artifactId>
144                 <version>2.6</version>
145                 <executions>
146                     <execution>
147                         <id>copy-dockerfile</id>
148                         <goals>
149                             <goal>copy-resources</goal>
150                         </goals><!-- here the phase you need -->
151                         <phase>validate</phase>
152                         <configuration>
153                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
154                             <resources>
155                                 <resource>
156                                     <directory>src/main/docker</directory>
157                                     <includes>
158                                         <include>Dockerfile</include>
159                                     </includes>
160                                     <filtering>true</filtering>
161                                 </resource>
162                             </resources>
163                         </configuration>
164                     </execution>
165                 </executions>
166             </plugin>
167
168
169
170         </plugins>
171
172     </build>
173
174     <profiles>
175         <profile>
176             <id>docker</id>
177             <build>
178                 <plugins>
179                     <plugin>
180                         <groupId>io.fabric8</groupId>
181                         <artifactId>docker-maven-plugin</artifactId>
182                         <version>0.16.5</version>
183                         <inherited>false</inherited>
184                         <configuration>
185                             <images>
186                                 <image>
187                                     <name>${image.name}</name>
188                                     <build>
189                                         <cleanup>try</cleanup>
190                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
191                                         <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
192                                         <tags>
193                                             <tag>${project.version}</tag>
194                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
195                                             <tag>${project.docker.latesttag.version}</tag>
196                                         </tags>
197                                     </build>
198                                 </image>
199                             </images>
200                         </configuration>
201                         <executions>
202                             <execution>
203                                 <id>generate-images</id>
204                                 <phase>package</phase>
205                                 <goals>
206                                     <goal>build</goal>
207                                 </goals>
208                             </execution>
209
210                             <execution>
211                                 <id>push-images</id>
212                                 <phase>deploy</phase>
213                                 <goals>
214                                     <goal>build</goal>
215                                     <goal>push</goal>
216                                 </goals>
217                             </execution>
218                         </executions>
219                     </plugin>
220
221                 </plugins>
222             </build>
223         </profile>
224
225     </profiles>
226     <organization>
227         <name>openECOMP</name>
228     </organization>
229 </project>