7d99deb387368e777985e8210ee66e2168d24401
[demo.git] / vnfs / honeycomb_plugin / sample_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 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19
20
21 <parent>
22     <groupId>org.openecomp.demo.vnf</groupId>
23     <artifactId>demo-aggregator</artifactId>
24     <version>1.0.0-SNAPSHOT</version>
25     <relativePath>../../../../pom.xml</relativePath>
26 </parent>
27
28     <properties>
29         <!--nexusproxy>http://nexus.fd.io/content</nexusproxy-->
30         <start.script.template>
31 #!/bin/sh -
32 STATUS=100
33
34 while [ $STATUS -eq 100 ]
35 do
36   %s
37   STATUS=$?
38   echo "Honeycomb exited with status: $STATUS"
39   if [ $STATUS -eq 100 ]
40   then
41     echo "Restarting..."
42   fi
43 done
44         </start.script.template>
45         <exec.parameters>-Xms32m -Xmx128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=128m</exec.parameters>
46         <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>
47         <debug.parameters>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.parameters>
48         <guice.version>4.1.0</guice.version>
49         <guice.config.version>1.2.0</guice.config.version>
50         <restconf.version>1.3.2-Beryllium-SR2</restconf.version>
51         <netconf.version>1.0.2-Beryllium-SR2</netconf.version>
52         <jersey.version>1.19.1</jersey.version>
53         <jetty.version>9.3.11.v20160721</jetty.version>
54         <servlet.version>3.1.0</servlet.version>
55         <yangtools.version>0.8.2-Beryllium-SR2</yangtools.version>
56         <mdsal.version>1.3.2-Beryllium-SR2</mdsal.version>
57         <!-- Used by mdsal as provided/runtime dependency-->
58         <osgi.core.version>5.0.0</osgi.core.version>
59     </properties>
60
61     <modelVersion>4.0.0</modelVersion>
62     <groupId>io.fd.honeycomb.common</groupId>
63     <artifactId>minimal-distribution-parent</artifactId>
64     <version>1.16.9</version>
65     <packaging>pom</packaging>
66
67     <!-- Generate executable shell script -->
68   <modules>
69     <module>../sample-plugin-api</module>
70     <module>../sample-plugin-impl</module>
71     <module>../sample-distribution</module>
72   </modules>
73
74     <build>
75         <pluginManagement>
76             <plugins>
77                 <plugin>
78                     <groupId>org.apache.maven.plugins</groupId>
79                     <artifactId>maven-compiler-plugin</artifactId>
80                     <version>3.3</version>
81                     <configuration>
82                         <!-- Use google's error-prone static analysis-->
83                         <compilerId>javac-with-errorprone</compilerId>
84                         <forceJavacCompilerUse>true</forceJavacCompilerUse>
85                         <showWarnings>true</showWarnings>
86                         <source>1.8</source>
87                         <target>1.8</target>
88                     </configuration>
89                     <dependencies>
90                         <dependency>
91                             <groupId>org.codehaus.plexus</groupId>
92                             <artifactId>plexus-compiler-javac-errorprone</artifactId>
93                             <version>2.5</version>
94                         </dependency>
95                         <!-- override plexus-compiler-javac-errorprone's dependency on
96                              Error Prone with the latest version -->
97                         <dependency>
98                             <groupId>com.google.errorprone</groupId>
99                             <artifactId>error_prone_core</artifactId>
100                             <version>2.0.9</version>
101                         </dependency>
102                     </dependencies>
103                 </plugin>
104                 <plugin>
105                     <groupId>org.apache.maven.plugins</groupId>
106                     <artifactId>maven-jar-plugin</artifactId>
107                     <version>2.6</version>
108                     <configuration>
109                         <archive>
110                             <manifest>
111                                 <mainClass>${main.class}</mainClass>
112                                 <addClasspath>true</addClasspath>
113                                 <classpathPrefix>lib/</classpathPrefix>
114                                 <useUniqueVersions>false</useUniqueVersions>
115                                 <classpathMavenRepositoryLayout>true</classpathMavenRepositoryLayout>
116                             </manifest>
117                             <manifestEntries>
118                                 <Class-Path>config/ cert/</Class-Path>
119                             </manifestEntries>
120                         </archive>
121                     </configuration>
122                 </plugin>
123
124                 <!-- Copy all dependencies -->
125                 <plugin>
126                     <groupId>org.apache.maven.plugins</groupId>
127                     <artifactId>maven-dependency-plugin</artifactId>
128                     <version>2.10</version>
129                     <executions>
130                         <execution>
131                             <id>copy-dependencies</id>
132                             <phase>package</phase>
133                             <goals>
134                                 <goal>copy-dependencies</goal>
135                             </goals>
136                             <configuration>
137                                 <outputDirectory>${project.build.directory}/lib</outputDirectory>
138                                 <useBaseVersion>true</useBaseVersion>
139                                 <useRepositoryLayout>true</useRepositoryLayout>
140                                 <excludeArtifactIds>yang-jmx-generator</excludeArtifactIds>
141                             </configuration>
142                         </execution>
143                         <execution>
144                             <id>unpack-configuration</id>
145                             <phase>prepare-package</phase>
146                             <goals>
147                                 <goal>unpack-dependencies</goal>
148                             </goals>
149                             <configuration>
150                                 <includes>**/honeycomb-minimal-resources/</includes>
151                                 <outputDirectory>${project.build.outputDirectory}/</outputDirectory>
152                             </configuration>
153                         </execution>
154                     </executions>
155                 </plugin>
156
157                 <!-- Generate shell script -->
158                 <plugin>
159                     <groupId>org.codehaus.gmaven</groupId>
160                     <artifactId>groovy-maven-plugin</artifactId>
161                     <version>2.0</version>
162                     <executions>
163                         <execution>
164                             <phase>package</phase>
165                             <goals>
166                                 <goal>execute</goal>
167                             </goals>
168                             <configuration>
169                                 <!-- TODO add remote debug option -->
170                                 <!-- TODO add clean option -->
171                                 <!-- TODO add shutdown script -->
172                                 <!-- TODO add restart script -->
173                                 <!-- TODO pass options to JVM? -->
174                                 <source>
175                                     import java.nio.file.Paths
176
177                                     log.info "Generating shell exec script"
178                                     def scriptTemplate = properties.getOrDefault("start.script.template", "")
179                                     def args = properties.getOrDefault("exec.parameters", "")
180                                     log.debug "Additional shell exec script properties: ${args}"
181                                     def javaArgs = "${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar"
182                                     def scriptParent = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources")
183                                     scriptParent.toFile().mkdirs()
184                                     def scriptContent = "java " + javaArgs
185                                     log.info "Generating shell exec script as ${scriptContent}"
186                                     def scriptPath = Paths.get(scriptParent.toString(), "honeycomb")
187                                     log.info "Writing shell exec script to ${scriptPath}"
188                                     scriptPath.toFile().text = String.format(scriptTemplate, scriptContent)
189                                     scriptPath.toFile().setExecutable(true)
190
191                                     scriptPath = Paths.get(scriptParent.toString(), "honeycomb-start")
192                                     log.info "Writing shell exec script to ${scriptPath}"
193                                     scriptPath.toFile().text = "\$(dirname \$0)/honeycomb &amp;"
194                                     scriptPath.toFile().setExecutable(true)
195
196                                     def debug_args = properties.getOrDefault("debug.parameters", "")
197                                     def debugScriptContent = "java" + " ${debug_args} " + javaArgs
198                                     log.info "Generating shell debug script as ${debugScriptContent}"
199                                     scriptPath = Paths.get(scriptParent.toString(), "honeycomb-debug")
200                                     log.info "Writing shell debug script to ${scriptPath}"
201                                     scriptPath.toFile().text = String.format(scriptTemplate, debugScriptContent)
202                                     scriptPath.toFile().setExecutable(true)
203                                 </source>
204                             </configuration>
205                         </execution>
206                     </executions>
207                 </plugin>
208
209                 <!-- Build archives -->
210                 <plugin>
211                     <artifactId>maven-assembly-plugin</artifactId>
212                     <version>2.5.3</version>
213                     <dependencies>
214                         <dependency>
215                             <groupId>io.fd.honeycomb.common</groupId>
216                             <artifactId>minimal-assembly-descriptor</artifactId>
217                             <version>1.16.9</version>
218                         </dependency>
219                     </dependencies>
220                     <executions>
221                         <execution>
222                             <id>create-archive</id>
223                             <phase>package</phase>
224                             <goals>
225                                 <goal>single</goal>
226                             </goals>
227                             <configuration>
228                                 <descriptorRefs>
229                                     <descriptorRef>honeycomb-minimal</descriptorRef>
230                                 </descriptorRefs>
231                             </configuration>
232                         </execution>
233                     </executions>
234                 </plugin>
235
236                 <plugin>
237                     <groupId>org.codehaus.mojo</groupId>
238                     <artifactId>exec-maven-plugin</artifactId>
239                     <executions>
240                         <execution>
241                             <phase>none</phase>
242                         </execution>
243                     </executions>
244                     <configuration>
245                         <skip>true</skip>
246                     </configuration>
247                 </plugin>
248             </plugins>
249         </pluginManagement>
250     </build>
251
252 </project>