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