Change the Version of Dockers to "Staging"
[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.0.0-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>yyMMdd-HHmmss</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                 </executions>
121             </plugin>
122             <plugin>
123                 <groupId>org.apache.maven.plugins</groupId>
124                 <artifactId>maven-dependency-plugin</artifactId>
125                 <executions>
126                     <execution>
127                         <id>copy-jar-${linux64id}</id>
128                         <goals>
129                             <goal>copy</goal>
130                         </goals>
131                         <phase>prepare-package</phase>
132                         <configuration>
133                             <artifactItems>
134                                 <artifactItem>
135                                     <groupId>org.onap.holmes.rule-management</groupId>
136                                     <artifactId>holmes-rulemgt</artifactId>
137                                     <type>jar</type>
138                                     <overWrite>true</overWrite>
139                                     <outputDirectory>${linux64outputdir}</outputDirectory>
140                                     <destFileName>holmes-rulemgt.jar</destFileName>
141                                 </artifactItem>
142                             </artifactItems>
143                         </configuration>
144                     </execution>
145                     <execution>
146                         <id>copy-jar-${win64id}</id>
147                         <goals>
148                             <goal>copy</goal>
149                         </goals>
150                         <phase>prepare-package</phase>
151                         <configuration>
152                             <artifactItems>
153                                 <artifactItem>
154                                     <groupId>org.onap.holmes.rule-management</groupId>
155                                     <artifactId>holmes-rulemgt</artifactId>
156                                     <type>jar</type>
157                                     <overWrite>true</overWrite>
158                                     <outputDirectory>${win64outputdir}</outputDirectory>
159                                     <destFileName>holmes-rulemgt.jar</destFileName>
160                                 </artifactItem>
161                             </artifactItems>
162                         </configuration>
163                     </execution>
164                 </executions>
165             </plugin>
166             <plugin>
167                 <groupId>org.apache.maven.plugins</groupId>
168                 <artifactId>maven-assembly-plugin</artifactId>
169                 <executions>
170                     <execution>
171                         <id>linux64</id>
172                         <configuration>
173                             <descriptors>
174                                 <descriptor>linux64-assembly.xml</descriptor>
175                             </descriptors>
176                             <appendAssemblyId>true</appendAssemblyId>
177                             <outputDirectory>target/version</outputDirectory>
178                         </configuration>
179                         <phase>package</phase>
180                         <goals>
181                             <goal>attached</goal>
182                         </goals>
183                     </execution>
184                     <execution>
185                         <id>win64</id>
186                         <configuration>
187                             <descriptors>
188                                 <descriptor>win64-assembly.xml</descriptor>
189                             </descriptors>
190                             <appendAssemblyId>true</appendAssemblyId>
191                             <outputDirectory>target/version</outputDirectory>
192                         </configuration>
193                         <phase>package</phase>
194                         <goals>
195                             <goal>attached</goal>
196                         </goals>
197                     </execution>
198                 </executions>
199             </plugin>
200             <plugin>
201                 <groupId>org.codehaus.groovy.maven</groupId>
202                 <artifactId>gmaven-plugin</artifactId>
203                 <executions>
204                     <execution>
205                         <phase>validate</phase>
206                         <goals>
207                             <goal>execute</goal>
208                         </goals>
209                         <configuration>
210                             <source>
211                                 println project.properties['holmes.rule.project.version'];
212                                 def versionArray;
213                                 if ( project.properties['holmes.rule.project.version'] != null ) {
214                                     versionArray = project.properties['holmes.rule.project.version'].split('-');
215                                 }
216
217                                 project.properties['project.docker.latesttag.version']=versionArray[0] + "-STAGING-latest";
218
219                                 println 'New Tag for docker:' +
220                                 project.properties['project.docker.latesttag.version'];
221                             </source>
222                         </configuration>
223                     </execution>
224                 </executions>
225             </plugin>
226         </plugins>
227     </build>
228
229     <profiles>
230         <profile>
231             <id>docker</id>
232             <build>
233                 <plugins>
234                     <plugin>
235                         <groupId>io.fabric8</groupId>
236                         <artifactId>docker-maven-plugin</artifactId>
237                         <version>0.16.5</version>
238                         <inherited>false</inherited>
239                         <configuration>
240                             <images>
241                                 <image>
242                                     <name>onap/holmes/rule-management</name>
243                                     <build>
244                                         <cleanup>try</cleanup>
245                                         <dockerFileDir>${basedir}/target/version/</dockerFileDir>
246                                         <dockerFile>${basedir}/target/version/Dockerfile</dockerFile>
247                                         <tags>
248                                             <tag>${project.version}</tag>
249                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
250                                             <tag>${project.docker.latesttag.version}</tag>
251                                         </tags>
252                                     </build>
253                                 </image>
254                             </images>
255                         </configuration>
256                         <executions>
257                             <execution>
258                                 <id>generate-images</id>
259                                 <phase>package</phase>
260                                 <goals>
261                                     <goal>build</goal>
262                                 </goals>
263                             </execution>
264
265                             <execution>
266                                 <id>push-images</id>
267                                 <phase>deploy</phase>
268                                 <goals>
269                                     <goal>build</goal>
270                                     <goal>push</goal>
271                                 </goals>
272                             </execution>
273                         </executions>
274                     </plugin>
275                 </plugins>
276             </build>
277         </profile>
278     </profiles>
279
280     <dependencies>
281         <dependency>
282             <groupId>org.onap.holmes.rule-management</groupId>
283             <artifactId>holmes-rulemgt</artifactId>
284             <version>${project.version}</version>
285         </dependency>
286     </dependencies>
287 </project>