f368d5432583fbf83785c118fb44fb3407c36d75
[demo.git] / vnfs / honeycomb_plugin / parent-pom / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ~ Copyright (c) 2016 Cisco and/or its affiliates.
4   ~
5   ~ Licensed under the Apache License, Version 2.0 (the "License");
6   ~ you may not use this file except in compliance with the License.
7   ~ You may obtain a copy of the License at:
8   ~
9   ~     http://www.apache.org/licenses/LICENSE-2.0
10   ~
11   ~ Unless required by applicable law or agreed to in writing, software
12   ~ distributed under the License is distributed on an "AS IS" BASIS,
13   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   ~ See the License for the specific language governing permissions and
15   ~ limitations under the License.
16   -->
17
18 <!--
19     Modifications copyright © 2017 AT&T Intellectual Property
20 -->
21
22 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
25
26 <parent>
27     <groupId>org.onap.demo.vnf</groupId>
28     <artifactId>demo-aggregator</artifactId>
29     <version>1.5.0-SNAPSHOT</version>
30     <relativePath>../../../pom.xml</relativePath>
31 </parent>
32
33     <properties>
34         <nexusproxy>http://nexus.fd.io/content</nexusproxy>
35         <start.script.template>
36 #!/bin/sh -
37 STATUS=100
38
39 while [ $STATUS -eq 100 ]
40 do
41   %s
42   STATUS=$?
43   echo "Honeycomb exited with status: $STATUS"
44   if [ $STATUS -eq 100 ]
45   then
46     echo "Restarting..."
47   fi
48 done
49         </start.script.template>
50         <exec.parameters>-Xms32m -Xmx128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=128m</exec.parameters>
51         <exec.parameters.minimal>-client -Xms20m -Xmx32m -XX:MetaspaceSize=5m -XX:MaxMetaspaceSize=32m -XX:MaxMetaspaceExpansion=1m -Xss512k -XX:+UseSerialGC -Djava.compiler=NONE -Xverify:none -noverify</exec.parameters.minimal>
52         <debug.parameters>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.parameters>
53         <guice.version>4.1.0</guice.version>
54         <guice.config.version>1.2.0</guice.config.version>
55         <jersey.version>1.19.1</jersey.version>
56         <jetty.version>9.3.11.v20160721</jetty.version>
57         <servlet.version>3.1.0</servlet.version>
58     </properties>
59
60     <modelVersion>4.0.0</modelVersion>
61     <artifactId>hc-onap</artifactId>
62     <packaging>pom</packaging>
63
64     <!-- Generate executable shell script -->
65   <modules>
66     <module>../stream-count/stream-count-api</module>
67     <module>../stream-count/stream-count-impl</module>
68     <module>../stream-count/stream-count-distribution</module>
69   </modules>
70
71     <build>
72         <pluginManagement>
73             <plugins>
74                 <plugin>
75                     <groupId>org.apache.maven.plugins</groupId>
76                     <artifactId>maven-compiler-plugin</artifactId>
77                     <version>3.3</version>
78                     <configuration>
79                         <!-- Use google's error-prone static analysis-->
80                         <compilerId>javac-with-errorprone</compilerId>
81                         <forceJavacCompilerUse>true</forceJavacCompilerUse>
82                         <showWarnings>true</showWarnings>
83                         <source>1.8</source>
84                         <target>1.8</target>
85                     </configuration>
86                     <dependencies>
87                         <dependency>
88                             <groupId>org.codehaus.plexus</groupId>
89                             <artifactId>plexus-compiler-javac-errorprone</artifactId>
90                             <version>2.5</version>
91                         </dependency>
92                         <!-- override plexus-compiler-javac-errorprone's dependency on
93                              Error Prone with the latest version -->
94                         <dependency>
95                             <groupId>com.google.errorprone</groupId>
96                             <artifactId>error_prone_core</artifactId>
97                             <version>2.0.9</version>
98                         </dependency>
99                     </dependencies>
100                 </plugin>
101                 <plugin>
102                     <groupId>org.apache.maven.plugins</groupId>
103                     <artifactId>maven-jar-plugin</artifactId>
104                     <version>2.6</version>
105                     <configuration>
106                         <archive>
107                             <manifest>
108                                 <mainClass>${main.class}</mainClass>
109                                 <addClasspath>true</addClasspath>
110                                 <classpathPrefix>lib/</classpathPrefix>
111                                 <useUniqueVersions>false</useUniqueVersions>
112                                 <classpathMavenRepositoryLayout>true</classpathMavenRepositoryLayout>
113                             </manifest>
114                             <manifestEntries>
115                                 <Class-Path>config/ cert/</Class-Path>
116                             </manifestEntries>
117                         </archive>
118                     </configuration>
119                 </plugin>
120
121                 <!-- Copy all dependencies -->
122                 <plugin>
123                     <groupId>org.apache.maven.plugins</groupId>
124                     <artifactId>maven-dependency-plugin</artifactId>
125                     <version>2.10</version>
126                     <executions>
127                         <execution>
128                             <id>copy-dependencies</id>
129                             <phase>package</phase>
130                             <goals>
131                                 <goal>copy-dependencies</goal>
132                             </goals>
133                             <configuration>
134                                 <outputDirectory>${project.build.directory}/lib</outputDirectory>
135                                 <useBaseVersion>true</useBaseVersion>
136                                 <useRepositoryLayout>true</useRepositoryLayout>
137                                 <excludeArtifactIds>yang-jmx-generator</excludeArtifactIds>
138                             </configuration>
139                         </execution>
140                         <execution>
141                             <id>unpack-configuration</id>
142                             <phase>prepare-package</phase>
143                             <goals>
144                                 <goal>unpack-dependencies</goal>
145                             </goals>
146                             <configuration>
147                                 <includes>**/honeycomb-minimal-resources/</includes>
148                                 <outputDirectory>${project.build.outputDirectory}/</outputDirectory>
149                             </configuration>
150                         </execution>
151                     </executions>
152                 </plugin>
153
154                 <!-- Generate shell script -->
155                 <plugin>
156                     <groupId>org.codehaus.gmaven</groupId>
157                     <artifactId>groovy-maven-plugin</artifactId>
158                     <version>2.0</version>
159                     <executions>
160                         <execution>
161                             <phase>package</phase>
162                             <goals>
163                                 <goal>execute</goal>
164                             </goals>
165                             <configuration>
166                                 <!-- TODO add remote debug option -->
167                                 <!-- TODO add clean option -->
168                                 <!-- TODO add shutdown script -->
169                                 <!-- TODO add restart script -->
170                                 <!-- TODO pass options to JVM? -->
171                                 <source>
172                                     import java.nio.file.Paths
173
174                                     log.info "Generating shell exec script"
175                                     def scriptTemplate = properties.getOrDefault("start.script.template", "")
176                                     def args = properties.getOrDefault("exec.parameters", "")
177                                     log.debug "Additional shell exec script properties: ${args}"
178                                     def javaArgs = "${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar"
179                                     def scriptParent = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources")
180                                     scriptParent.toFile().mkdirs()
181                                     def scriptContent = "java " + javaArgs
182                                     log.info "Generating shell exec script as ${scriptContent}"
183                                     def scriptPath = Paths.get(scriptParent.toString(), "honeycomb")
184                                     log.info "Writing shell exec script to ${scriptPath}"
185                                     scriptPath.toFile().text = String.format(scriptTemplate, scriptContent)
186                                     scriptPath.toFile().setExecutable(true)
187
188                                     scriptPath = Paths.get(scriptParent.toString(), "honeycomb-start")
189                                     log.info "Writing shell exec script to ${scriptPath}"
190                                     scriptPath.toFile().text = "\$(dirname \$0)/honeycomb &amp;"
191                                     scriptPath.toFile().setExecutable(true)
192
193                                     def debug_args = properties.getOrDefault("debug.parameters", "")
194                                     def debugScriptContent = "java" + " ${debug_args} " + javaArgs
195                                     log.info "Generating shell debug script as ${debugScriptContent}"
196                                     scriptPath = Paths.get(scriptParent.toString(), "honeycomb-debug")
197                                     log.info "Writing shell debug script to ${scriptPath}"
198                                     scriptPath.toFile().text = String.format(scriptTemplate, debugScriptContent)
199                                     scriptPath.toFile().setExecutable(true)
200                                 </source>
201                             </configuration>
202                         </execution>
203                     </executions>
204                 </plugin>
205
206                 <!-- Build archives -->
207                 <plugin>
208                     <artifactId>maven-assembly-plugin</artifactId>
209                     <version>2.5.3</version>
210                     <dependencies>
211                         <dependency>
212                             <groupId>io.fd.honeycomb.common</groupId>
213                             <artifactId>minimal-assembly-descriptor</artifactId>
214                             <version>1.18.10</version>
215                         </dependency>
216                     </dependencies>
217                     <executions>
218                         <execution>
219                             <id>create-archive</id>
220                             <phase>package</phase>
221                             <goals>
222                                 <goal>single</goal>
223                             </goals>
224                             <configuration>
225                                 <descriptorRefs>
226                                     <descriptorRef>honeycomb-minimal</descriptorRef>
227                                 </descriptorRefs>
228                             </configuration>
229                         </execution>
230                     </executions>
231                 </plugin>
232
233                 <plugin>
234                     <groupId>org.codehaus.mojo</groupId>
235                     <artifactId>exec-maven-plugin</artifactId>
236                     <executions>
237                         <execution>
238                             <phase>none</phase>
239                         </execution>
240                     </executions>
241                     <configuration>
242                         <skip>true</skip>
243                     </configuration>
244                 </plugin>
245             </plugins>
246         </pluginManagement>
247     </build>
248
249 </project>