a6d3db3ca95cfac79652fb76b1002670f5bf6b7d
[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.6-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                                         <include>**/holmes-frontend*.*</include>
135                                         <include>**/*.pem</include>
136                                     </includes>
137                                 </resource>
138                             </resources>
139                             <overwrite>true</overwrite>
140                         </configuration>
141                     </execution>
142                 </executions>
143             </plugin>
144             <plugin>
145                 <groupId>org.apache.maven.plugins</groupId>
146                 <artifactId>maven-dependency-plugin</artifactId>
147                 <executions>
148                     <execution>
149                         <id>copy-artifacts-${linux64id}</id>
150                         <goals>
151                             <goal>copy</goal>
152                         </goals>
153                         <phase>prepare-package</phase>
154                         <configuration>
155                             <artifactItems>
156                                 <artifactItem>
157                                     <groupId>org.onap.holmes.rule-management</groupId>
158                                     <artifactId>holmes-rulemgt</artifactId>
159                                     <type>jar</type>
160                                     <overWrite>true</overWrite>
161                                     <outputDirectory>${linux64outputdir}</outputDirectory>
162                                     <destFileName>holmes-rulemgt.jar</destFileName>
163                                 </artifactItem>
164                                 <artifactItem>
165                                     <groupId>org.onap.holmes.rule-management</groupId>
166                                     <artifactId>holmes-rulemgt-frontend</artifactId>
167                                     <type>tar.gz</type>
168                                     <overWrite>true</overWrite>
169                                     <outputDirectory>target/version</outputDirectory>
170                                     <destFileName>holmes-rulemgt-frontend-${project.version}.tar.gz</destFileName>
171                                 </artifactItem>
172                             </artifactItems>
173                         </configuration>
174                     </execution>
175                     <execution>
176                         <id>copy-artifacts-${win64id}</id>
177                         <goals>
178                             <goal>copy</goal>
179                         </goals>
180                         <phase>prepare-package</phase>
181                         <configuration>
182                             <artifactItems>
183                                 <artifactItem>
184                                     <groupId>org.onap.holmes.rule-management</groupId>
185                                     <artifactId>holmes-rulemgt</artifactId>
186                                     <type>jar</type>
187                                     <overWrite>true</overWrite>
188                                     <outputDirectory>${win64outputdir}</outputDirectory>
189                                     <destFileName>holmes-rulemgt.jar</destFileName>
190                                 </artifactItem>
191                                 <artifactItem>
192                                     <groupId>org.onap.holmes.rule-management</groupId>
193                                     <artifactId>holmes-rulemgt-frontend</artifactId>
194                                     <type>tar.gz</type>
195                                     <overWrite>true</overWrite>
196                                     <outputDirectory>target/version</outputDirectory>
197                                     <destFileName>holmes-rulemgt-frontend-${project.version}.tar.gz</destFileName>
198                                 </artifactItem>
199                             </artifactItems>
200                         </configuration>
201                     </execution>
202                 </executions>
203             </plugin>
204             <plugin>
205                 <groupId>org.apache.maven.plugins</groupId>
206                 <artifactId>maven-assembly-plugin</artifactId>
207                 <executions>
208                     <execution>
209                         <id>linux64</id>
210                         <configuration>
211                             <descriptors>
212                                 <descriptor>linux64-assembly.xml</descriptor>
213                             </descriptors>
214                             <appendAssemblyId>true</appendAssemblyId>
215                             <outputDirectory>target/version</outputDirectory>
216                         </configuration>
217                         <phase>package</phase>
218                         <goals>
219                             <goal>attached</goal>
220                         </goals>
221                     </execution>
222                     <execution>
223                         <id>win64</id>
224                         <configuration>
225                             <descriptors>
226                                 <descriptor>win64-assembly.xml</descriptor>
227                             </descriptors>
228                             <appendAssemblyId>true</appendAssemblyId>
229                             <outputDirectory>target/version</outputDirectory>
230                         </configuration>
231                         <phase>package</phase>
232                         <goals>
233                             <goal>attached</goal>
234                         </goals>
235                     </execution>
236                 </executions>
237             </plugin>
238             <plugin>
239                 <groupId>org.codehaus.groovy.maven</groupId>
240                 <artifactId>gmaven-plugin</artifactId>
241                 <executions>
242                     <execution>
243                         <phase>validate</phase>
244                         <goals>
245                             <goal>execute</goal>
246                         </goals>
247                         <configuration>
248                             <source>
249                                 println project.properties['holmes.rule.project.version'];
250                                 def versionArray;
251                                 if (project.properties['holmes.rule.project.version'] != null) {
252                                     versionArray = project.properties['holmes.rule.project.version'].split('-');
253                                 }
254
255                                 project.properties['project.docker.latesttag.version'] = versionArray[0] + "-STAGING-latest";
256                                 project.properties['project.docker.latesttag.version.with.timestamp'] = versionArray[0] + "-STAGING-${build.number}";
257
258                                 println 'New Tag for docker:' +
259                                         project.properties['project.docker.latesttag.version'];
260                             </source>
261                         </configuration>
262                     </execution>
263                 </executions>
264             </plugin>
265         </plugins>
266     </build>
267
268     <profiles>
269         <profile>
270             <id>docker</id>
271             <build>
272                 <plugins>
273                     <plugin>
274                         <groupId>io.fabric8</groupId>
275                         <artifactId>docker-maven-plugin</artifactId>
276                         <version>0.16.5</version>
277                         <inherited>false</inherited>
278                         <configuration>
279                             <images>
280                                 <image>
281                                     <name>onap/holmes/rule-management</name>
282                                     <build>
283                                         <cleanup>try</cleanup>
284                                         <dockerFileDir>${basedir}/target/version/</dockerFileDir>
285                                         <dockerFile>${basedir}/target/version/Dockerfile</dockerFile>
286                                         <tags>
287                                             <tag>${project.version}</tag>
288                                             <tag>${project.version}-${build.number}</tag>
289                                             <tag>${project.docker.latesttag.version}</tag>
290                                             <tag>${project.docker.latesttag.version.with.timestamp}</tag>
291                                         </tags>
292                                     </build>
293                                 </image>
294                             </images>
295                         </configuration>
296                         <executions>
297                             <execution>
298                                 <id>generate-images</id>
299                                 <phase>package</phase>
300                                 <goals>
301                                     <goal>build</goal>
302                                 </goals>
303                             </execution>
304
305                             <execution>
306                                 <id>push-images</id>
307                                 <phase>deploy</phase>
308                                 <goals>
309                                     <goal>build</goal>
310                                     <goal>push</goal>
311                                 </goals>
312                             </execution>
313                         </executions>
314                     </plugin>
315                 </plugins>
316             </build>
317         </profile>
318     </profiles>
319
320     <dependencies>
321         <dependency>
322             <groupId>org.onap.holmes.rule-management</groupId>
323             <artifactId>holmes-rulemgt</artifactId>
324             <version>${project.version}</version>
325         </dependency>
326         <dependency>
327             <groupId>org.onap.holmes.rule-management</groupId>
328             <artifactId>holmes-rulemgt-frontend</artifactId>
329             <version>${project.version}</version>
330             <type>tar.gz</type>
331         </dependency>
332     </dependencies>
333 </project>