+
+ <!-- Generate shell script -->
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>groovy-maven-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ import java.nio.file.Paths
+
+ log.info "Generating shell exec script"
+ def scriptTemplate = properties.getOrDefault("start.script.template", "")
+ def args = properties.getOrDefault("exec.parameters", "")
+ log.debug "Additional shell exec script properties: ${args}"
+ def javaArgs = "${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar"
+ def scriptParent = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources")
+ scriptParent.toFile().mkdirs()
+ def scriptContent = "java " + javaArgs
+ log.info "Generating shell exec script as ${scriptContent}"
+ def scriptPath = Paths.get(scriptParent.toString(), "honeycomb")
+ log.info "Writing shell exec script to ${scriptPath}"
+ scriptPath.toFile().text = String.format(scriptTemplate, scriptContent)
+ scriptPath.toFile().setExecutable(true)
+
+ scriptPath = Paths.get(scriptParent.toString(), "honeycomb-start")
+ log.info "Writing shell exec script to ${scriptPath}"
+ scriptPath.toFile().text = "\$(dirname \$0)/honeycomb &"
+ scriptPath.toFile().setExecutable(true)
+
+ def debug_args = properties.getOrDefault("debug.parameters", "")
+ def debugScriptContent = "java" + " ${debug_args} " + javaArgs
+ log.info "Generating shell debug script as ${debugScriptContent}"
+ scriptPath = Paths.get(scriptParent.toString(), "honeycomb-debug")
+ log.info "Writing shell debug script to ${scriptPath}"
+ scriptPath.toFile().text = String.format(scriptTemplate, debugScriptContent)
+ scriptPath.toFile().setExecutable(true)
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>