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