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