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