Modified the Docker Tagging
[holmes/rule-management.git] / rulemgt-standalone / pom.xml
1 <?xml version="1.0"?>
2 <!--
3
4     Copyright 2017 ZTE Corporation.
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"
21          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22     <parent>
23         <groupId>org.onap.holmes.rule-management</groupId>
24         <artifactId>holmes-rulemgt-parent</artifactId>
25         <version>1.2.1-SNAPSHOT</version>
26     </parent>
27
28     <artifactId>holmes-rulemgt-standalone</artifactId>
29     <modelVersion>4.0.0</modelVersion>
30     <name>holmes-rulemgt/holmes-rulemgt-standalone</name>
31     <packaging>pom</packaging>
32
33     <properties>
34         <holmes.rule.project.version>${project.version}</holmes.rule.project.version>
35         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
36         <build.number>${maven.build.timestamp}</build.number>
37     </properties>
38
39     <build>
40         <plugins>
41             <plugin>
42                 <artifactId>maven-resources-plugin</artifactId>
43                 <executions>
44                     <execution>
45                         <id>copy-resources-${linux64id}</id>
46                         <phase>process-resources</phase>
47                         <goals>
48                             <goal>copy-resources</goal>
49                         </goals>
50                         <configuration>
51                             <outputDirectory>${linux64outputdir}</outputDirectory>
52                             <resources>
53                                 <resource>
54                                     <directory>src/main/assembly/</directory>
55                                     <filtering>false</filtering>
56                                     <includes>
57                                         <include>**/*</include>
58                                     </includes>
59                                     <excludes>
60                                         <exclude>**/*.bat</exclude>
61                                         <exclude>Dockerfile</exclude>
62                                     </excludes>
63                                 </resource>
64                                 <resource>
65                                     <directory>../rulemgt/src/main/resources</directory>
66                                     <filtering>false</filtering>
67                                 </resource>
68                             </resources>
69                             <overwrite>true</overwrite>
70                         </configuration>
71                     </execution>
72                     <execution>
73                         <id>copy-resources-${win64id}</id>
74                         <phase>process-resources</phase>
75                         <goals>
76                             <goal>copy-resources</goal>
77                         </goals>
78                         <configuration>
79                             <outputDirectory>${win64outputdir}</outputDirectory>
80                             <resources>
81                                 <resource>
82                                     <directory>src/main/assembly/</directory>
83                                     <filtering>false</filtering>
84                                     <includes>
85                                         <include>**/*</include>
86                                     </includes>
87                                     <excludes>
88                                         <exclude>**/*.sh</exclude>
89                                         <exclude>Dockerfile</exclude>
90                                     </excludes>
91                                 </resource>
92                                 <resource>
93                                     <directory>../rulemgt/src/main/resources</directory>
94                                     <filtering>false</filtering>
95                                 </resource>
96                             </resources>
97                             <overwrite>true</overwrite>
98                         </configuration>
99                     </execution>
100                     <execution>
101                         <id>copy-dockerfile</id>
102                         <phase>process-resources</phase>
103                         <goals>
104                             <goal>copy-resources</goal>
105                         </goals>
106                         <configuration>
107                             <outputDirectory>target/version</outputDirectory>
108                             <resources>
109                                 <resource>
110                                     <directory>src/main/assembly/</directory>
111                                     <filtering>false</filtering>
112                                     <includes>
113                                         <include>Dockerfile</include>
114                                     </includes>
115                                 </resource>
116                             </resources>
117                             <overwrite>true</overwrite>
118                         </configuration>
119                     </execution>
120                     <execution>
121                         <id>copy-nginx-conf-file</id>
122                         <phase>process-resources</phase>
123                         <goals>
124                             <goal>copy-resources</goal>
125                         </goals>
126                         <configuration>
127                             <outputDirectory>target/version</outputDirectory>
128                             <resources>
129                                 <resource>
130                                     <directory>src/main/assembly/</directory>
131                                     <filtering>false</filtering>
132                                     <includes>
133                                         <include>nginx.conf</include>
134                                     </includes>
135                                 </resource>
136                             </resources>
137                             <overwrite>true</overwrite>
138                         </configuration>
139                     </execution>
140                 </executions>
141             </plugin>
142             <plugin>
143                 <groupId>org.apache.maven.plugins</groupId>
144                 <artifactId>maven-dependency-plugin</artifactId>
145                 <executions>
146                     <execution>
147                         <id>copy-artifacts-${linux64id}</id>
148                         <goals>
149                             <goal>copy</goal>
150                         </goals>
151                         <phase>prepare-package</phase>
152                         <configuration>
153                             <artifactItems>
154                                 <artifactItem>
155                                     <groupId>org.onap.holmes.rule-management</groupId>
156                                     <artifactId>holmes-rulemgt</artifactId>
157                                     <type>jar</type>
158                                     <overWrite>true</overWrite>
159                                     <outputDirectory>${linux64outputdir}</outputDirectory>
160                                     <destFileName>holmes-rulemgt.jar</destFileName>
161                                 </artifactItem>
162                                 <artifactItem>
163                                     <groupId>org.onap.holmes.rule-management</groupId>
164                                     <artifactId>holmes-rulemgt-frontend</artifactId>
165                                     <type>tar.gz</type>
166                                     <overWrite>true</overWrite>
167                                     <outputDirectory>target/version</outputDirectory>
168                                     <destFileName>holmes-rulemgt-frontend-${project.version}.tar.gz</destFileName>
169                                 </artifactItem>
170                             </artifactItems>
171                         </configuration>
172                     </execution>
173                     <execution>
174                         <id>copy-artifacts-${win64id}</id>
175                         <goals>
176                             <goal>copy</goal>
177                         </goals>
178                         <phase>prepare-package</phase>
179                         <configuration>
180                             <artifactItems>
181                                 <artifactItem>
182                                     <groupId>org.onap.holmes.rule-management</groupId>
183                                     <artifactId>holmes-rulemgt</artifactId>
184                                     <type>jar</type>
185                                     <overWrite>true</overWrite>
186                                     <outputDirectory>${win64outputdir}</outputDirectory>
187                                     <destFileName>holmes-rulemgt.jar</destFileName>
188                                 </artifactItem>
189                                 <artifactItem>
190                                     <groupId>org.onap.holmes.rule-management</groupId>
191                                     <artifactId>holmes-rulemgt-frontend</artifactId>
192                                     <type>tar.gz</type>
193                                     <overWrite>true</overWrite>
194                                     <outputDirectory>target/version</outputDirectory>
195                                     <destFileName>holmes-rulemgt-frontend-${project.version}.tar.gz</destFileName>
196                                 </artifactItem>
197                             </artifactItems>
198                         </configuration>
199                     </execution>
200                 </executions>
201             </plugin>
202             <plugin>
203                 <groupId>org.apache.maven.plugins</groupId>
204                 <artifactId>maven-assembly-plugin</artifactId>
205                 <executions>
206                     <execution>
207                         <id>linux64</id>
208                         <configuration>
209                             <descriptors>
210                                 <descriptor>linux64-assembly.xml</descriptor>
211                             </descriptors>
212                             <appendAssemblyId>true</appendAssemblyId>
213                             <outputDirectory>target/version</outputDirectory>
214                         </configuration>
215                         <phase>package</phase>
216                         <goals>
217                             <goal>attached</goal>
218                         </goals>
219                     </execution>
220                     <execution>
221                         <id>win64</id>
222                         <configuration>
223                             <descriptors>
224                                 <descriptor>win64-assembly.xml</descriptor>
225                             </descriptors>
226                             <appendAssemblyId>true</appendAssemblyId>
227                             <outputDirectory>target/version</outputDirectory>
228                         </configuration>
229                         <phase>package</phase>
230                         <goals>
231                             <goal>attached</goal>
232                         </goals>
233                     </execution>
234                 </executions>
235             </plugin>
236             <plugin>
237                 <groupId>org.codehaus.groovy.maven</groupId>
238                 <artifactId>gmaven-plugin</artifactId>
239                 <executions>
240                     <execution>
241                         <phase>validate</phase>
242                         <goals>
243                             <goal>execute</goal>
244                         </goals>
245                         <configuration>
246                             <source>
247                                 println project.properties['holmes.rule.project.version'];
248                                 def versionArray;
249                                 if (project.properties['holmes.rule.project.version'] != null) {
250                                     versionArray = project.properties['holmes.rule.project.version'].split('-');
251                                 }
252
253                                 project.properties['project.docker.latesttag.version'] = versionArray[0] + "-STAGING-latest";
254                                 project.properties['project.docker.latesttag.version.with.timestamp'] = versionArray[0] + "-STAGING-${build.number}";
255
256                                 println 'New Tag for docker:' +
257                                         project.properties['project.docker.latesttag.version'];
258                             </source>
259                         </configuration>
260                     </execution>
261                 </executions>
262             </plugin>
263         </plugins>
264     </build>
265
266     <profiles>
267         <profile>
268             <id>docker</id>
269             <build>
270                 <plugins>
271                     <plugin>
272                         <groupId>io.fabric8</groupId>
273                         <artifactId>docker-maven-plugin</artifactId>
274                         <version>0.16.5</version>
275                         <inherited>false</inherited>
276                         <configuration>
277                             <images>
278                                 <image>
279                                     <name>onap/holmes/rule-management</name>
280                                     <build>
281                                         <cleanup>try</cleanup>
282                                         <dockerFileDir>${basedir}/target/version/</dockerFileDir>
283                                         <dockerFile>${basedir}/target/version/Dockerfile</dockerFile>
284                                         <tags>
285                                             <tag>${project.version}</tag>
286                                             <tag>${project.version}-${build.number}</tag>
287                                             <tag>${project.docker.latesttag.version}</tag>
288                                             <tag>${project.docker.latesttag.version.with.timestamp}</tag>
289                                         </tags>
290                                     </build>
291                                 </image>
292                             </images>
293                         </configuration>
294                         <executions>
295                             <execution>
296                                 <id>generate-images</id>
297                                 <phase>package</phase>
298                                 <goals>
299                                     <goal>build</goal>
300                                 </goals>
301                             </execution>
302
303                             <execution>
304                                 <id>push-images</id>
305                                 <phase>deploy</phase>
306                                 <goals>
307                                     <goal>build</goal>
308                                     <goal>push</goal>
309                                 </goals>
310                             </execution>
311                         </executions>
312                     </plugin>
313                 </plugins>
314             </build>
315         </profile>
316     </profiles>
317
318     <dependencies>
319         <dependency>
320             <groupId>org.onap.holmes.rule-management</groupId>
321             <artifactId>holmes-rulemgt</artifactId>
322             <version>${project.version}</version>
323         </dependency>
324         <dependency>
325             <groupId>org.onap.holmes.rule-management</groupId>
326             <artifactId>holmes-rulemgt-frontend</artifactId>
327             <version>${project.version}</version>
328             <type>tar.gz</type>
329         </dependency>
330     </dependencies>
331 </project>