Add "INIT INFO" property substitutions
Update the "INIT INFO section" of `launch.script` to include
`initInfoProvides`, `initInfoShortDescription` and `initInfoDescription`
property substitutions.
The Maven plugin has been updated to populate substitutions with
`${project.artifactId}`, `${project.name}` and `${project.description}`.
Fixes gh-4245
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-executable</artifactId>
|
||||
<name>MyFullyExecutableJarName</name>
|
||||
<description>MyFullyExecutableJarDesc</description>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -2,6 +2,7 @@ import java.io.*;
|
||||
import org.springframework.boot.maven.*;
|
||||
|
||||
Verify.verifyJar(
|
||||
new File( basedir, "target/jar-executable-0.0.1.BUILD-SNAPSHOT.jar" ), "some.random.Main", "Spring Boot Startup Script"
|
||||
);
|
||||
new File( basedir, "target/jar-executable-0.0.1.BUILD-SNAPSHOT.jar" ),
|
||||
"some.random.Main", "Spring Boot Startup Script", "MyFullyExecutableJarName",
|
||||
"MyFullyExecutableJarDesc");
|
||||
|
||||
|
||||
@@ -248,11 +248,36 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
|
||||
private LaunchScript getLaunchScript() throws IOException {
|
||||
if (this.executable || this.embeddedLaunchScript != null) {
|
||||
return new DefaultLaunchScript(this.embeddedLaunchScript,
|
||||
this.embeddedLaunchScriptProperties);
|
||||
buildLaunchScriptProperties());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Properties buildLaunchScriptProperties() {
|
||||
Properties properties = new Properties();
|
||||
if (this.embeddedLaunchScriptProperties != null) {
|
||||
properties.putAll(this.embeddedLaunchScriptProperties);
|
||||
}
|
||||
putIfMissing(properties, "initInfoProvides", this.project.getArtifactId());
|
||||
putIfMissing(properties, "initInfoShortDescription", this.project.getName(),
|
||||
this.project.getArtifactId());
|
||||
putIfMissing(properties, "initInfoDescription", this.project.getDescription(),
|
||||
this.project.getName(), this.project.getArtifactId());
|
||||
return properties;
|
||||
}
|
||||
|
||||
private void putIfMissing(Properties properties, String key,
|
||||
String... valueCandidates) {
|
||||
if (!properties.containsKey(key)) {
|
||||
for (String candidate : valueCandidates) {
|
||||
if (candidate != null && candidate.length() > 0) {
|
||||
properties.put(key, candidate);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive layout types.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user