d8322b89f6860eb51453681d6f374ec6d6013f4b
[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         <!--restconf.version>1.3.2-Beryllium-SR2</restconf.version-->
56         <!--netconf.version>1.0.2-Beryllium-SR2</netconf.version-->
57         <jersey.version>1.19.1</jersey.version>
58         <jetty.version>9.3.11.v20160721</jetty.version>
59         <servlet.version>3.1.0</servlet.version>
60         <!--yangtools.version>0.8.2-Beryllium-SR2</yangtools.version-->
61         <!--mdsal.version>1.3.2-Beryllium-SR2</mdsal.version-->
62         <!-- Used by mdsal as provided/runtime dependency-->
63         <!--osgi.core.version>5.0.0</osgi.core.version-->
64     </properties>
65
66     <modelVersion>4.0.0</modelVersion>
67     <artifactId>hc-onap</artifactId>
68     <packaging>pom</packaging>
69
70     <!-- Generate executable shell script -->
71   <modules>
72     <!--module>../sample-plugin/sample-plugin-api</module-->
73     <!--module>../sample-plugin/sample-plugin-impl</module-->
74     <module>../stream-count/stream-count-api</module>
75     <module>../stream-count/stream-count-impl</module>
76     <module>../stream-count/stream-count-distribution</module>
77     <!--module>../sample-distribution</module-->
78   </modules>
79
80     <build>
81         <pluginManagement>
82             <plugins>
83                 <plugin>
84                     <groupId>org.apache.maven.plugins</groupId>
85                     <artifactId>maven-compiler-plugin</artifactId>
86                     <version>3.3</version>
87                     <configuration>
88                         <!-- Use google's error-prone static analysis-->
89                         <compilerId>javac-with-errorprone</compilerId>
90                         <forceJavacCompilerUse>true</forceJavacCompilerUse>
91                         <showWarnings>true</showWarnings>
92                         <source>1.8</source>
93                         <target>1.8</target>
94                     </configuration>
95                     <dependencies>
96                         <dependency>
97                             <groupId>org.codehaus.plexus</groupId>
98                             <artifactId>plexus-compiler-javac-errorprone</artifactId>
99                             <version>2.5</version>
100                         </dependency>
101                         <!-- override plexus-compiler-javac-errorprone's dependency on
102                              Error Prone with the latest version -->
103                         <dependency>
104                             <groupId>com.google.errorprone</groupId>
105                             <artifactId>error_prone_core</artifactId>
106                             <version>2.0.9</version>
107                         </dependency>
108                     </dependencies>
109                 </plugin>
110                 <plugin>
111                     <groupId>org.apache.maven.plugins</groupId>
112                     <artifactId>maven-jar-plugin</artifactId>
113                     <version>2.6</version>
114                     <configuration>
115                         <archive>
116                             <manifest>
117                                 <mainClass>${main.class}</mainClass>
118                                 <addClasspath>true</addClasspath>
119                                 <classpathPrefix>lib/</classpathPrefix>
120                                 <useUniqueVersions>false</useUniqueVersions>
121                                 <classpathMavenRepositoryLayout>true</classpathMavenRepositoryLayout>
122                             </manifest>
123                             <manifestEntries>
124                                 <Class-Path>config/ cert/</Class-Path>
125                             </manifestEntries>
126                         </archive>
127                     </configuration>
128                 </plugin>
129
130                 <!-- Copy all dependencies -->
131                 <plugin>
132                     <groupId>org.apache.maven.plugins</groupId>
133                     <artifactId>maven-dependency-plugin</artifactId>
134                     <version>2.10</version>
135                     <executions>
136                         <execution>
137                             <id>copy-dependencies</id>
138                             <phase>package</phase>
139                             <goals>
140                                 <goal>copy-dependencies</goal>
141                             </goals>
142                             <configuration>
143                                 <outputDirectory>${project.build.directory}/lib</outputDirectory>
144                                 <useBaseVersion>true</useBaseVersion>
145                                 <useRepositoryLayout>true</useRepositoryLayout>
146                                 <excludeArtifactIds>yang-jmx-generator</excludeArtifactIds>
147                             </configuration>
148                         </execution>
149                         <execution>
150                             <id>unpack-configuration</id>
151                             <phase>prepare-package</phase>
152                             <goals>
153                                 <goal>unpack-dependencies</goal>
154                             </goals>
155                             <configuration>
156                                 <includes>**/honeycomb-minimal-resources/</includes>
157                                 <outputDirectory>${project.build.outputDirectory}/</outputDirectory>
158                             </configuration>
159                         </execution>
160                     </executions>
161                 </plugin>
162
163                 <!-- Generate shell script -->
164                 <plugin>
165                     <groupId>org.codehaus.gmaven</groupId>
166                     <artifactId>groovy-maven-plugin</artifactId>
167                     <version>2.0</version>
168                     <executions>
169                         <execution>
170                             <phase>package</phase>
171                             <goals>
172                                 <goal>execute</goal>
173                             </goals>
174                             <configuration>
175                                 <!-- TODO add remote debug option -->
176                                 <!-- TODO add clean option -->
177                                 <!-- TODO add shutdown script -->
178                                 <!-- TODO add restart script -->
179                                 <!-- TODO pass options to JVM? -->
180                                 <source>
181                                     import java.nio.file.Paths
182
183                                     log.info "Generating shell exec script"
184                                     def scriptTemplate = properties.getOrDefault("start.script.template", "")
185                                     def args = properties.getOrDefault("exec.parameters", "")
186                                     log.debug "Additional shell exec script properties: ${args}"
187                                     def javaArgs = "${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar"
188                                     def scriptParent = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources")
189                                     scriptParent.toFile().mkdirs()
190                                     def scriptContent = "java " + javaArgs
191                                     log.info "Generating shell exec script as ${scriptContent}"
192                                     def scriptPath = Paths.get(scriptParent.toString(), "honeycomb")
193                                     log.info "Writing shell exec script to ${scriptPath}"
194                                     scriptPath.toFile().text = String.format(scriptTemplate, scriptContent)
195                                     scriptPath.toFile().setExecutable(true)
196
197                                     scriptPath = Paths.get(scriptParent.toString(), "honeycomb-start")
198                                     log.info "Writing shell exec script to ${scriptPath}"
199                                     scriptPath.toFile().text = "\$(dirname \$0)/honeycomb &amp;"
200                                     scriptPath.toFile().setExecutable(true)
201
202                                     def debug_args = properties.getOrDefault("debug.parameters", "")
203                                     def debugScriptContent = "java" + " ${debug_args} " + javaArgs
204                                     log.info "Generating shell debug script as ${debugScriptContent}"
205                                     scriptPath = Paths.get(scriptParent.toString(), "honeycomb-debug")
206                                     log.info "Writing shell debug script to ${scriptPath}"
207                                     scriptPath.toFile().text = String.format(scriptTemplate, debugScriptContent)
208                                     scriptPath.toFile().setExecutable(true)
209                                 </source>
210                             </configuration>
211                         </execution>
212                     </executions>
213                 </plugin>
214
215                 <!-- Build archives -->
216                 <plugin>
217                     <artifactId>maven-assembly-plugin</artifactId>
218                     <version>2.5.3</version>
219                     <dependencies>
220                         <dependency>
221                             <groupId>io.fd.honeycomb.common</groupId>
222                             <artifactId>minimal-assembly-descriptor</artifactId>
223                             <version>1.18.10</version>
224                         </dependency>
225                     </dependencies>
226                     <executions>
227                         <execution>
228                             <id>create-archive</id>
229                             <phase>package</phase>
230                             <goals>
231                                 <goal>single</goal>
232                             </goals>
233                             <configuration>
234                                 <descriptorRefs>
235                                     <descriptorRef>honeycomb-minimal</descriptorRef>
236                                 </descriptorRefs>
237                             </configuration>
238                         </execution>
239                     </executions>
240                 </plugin>
241
242                 <plugin>
243                     <groupId>org.codehaus.mojo</groupId>
244                     <artifactId>exec-maven-plugin</artifactId>
245                     <executions>
246                         <execution>
247                             <phase>none</phase>
248                         </execution>
249                     </executions>
250                     <configuration>
251                         <skip>true</skip>
252                     </configuration>
253                 </plugin>
254             </plugins>
255         </pluginManagement>
256     </build>
257
258 </project>