mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Add git commit id to MANIFEST in boot tools repackager
This commit is contained in:
parent
b0c54a6588
commit
281c650251
@ -19,4 +19,25 @@
|
||||
<module>spring-boot-maven-plugin</module>
|
||||
<module>spring-boot-gradle-plugin</module>
|
||||
</modules>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
|
||||
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||
<generateGitPropertiesFilename>src/main/resources/org/springframework/boot/git.properties</generateGitPropertiesFilename>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -0,0 +1,13 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Mon Oct 14 16:04:34 EDT 2013
|
||||
git.commit.id.abbrev=b0c54a6
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
|
||||
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
|
||||
git.commit.message.short=Add parent class loader entries if possible
|
||||
git.commit.user.name=Dave Syer
|
||||
git.build.user.name=Dave Syer
|
||||
git.build.user.email=dsyer@gopivotal.com
|
||||
git.branch=master
|
||||
git.commit.time=2013-10-14T16\:02\:04-0400
|
||||
git.build.time=2013-10-14T16\:04\:34-0400
|
@ -18,6 +18,8 @@ package org.springframework.boot.loader.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
@ -33,6 +35,10 @@ public class Repackager {
|
||||
|
||||
private static final String START_CLASS_ATTRIBUTE = "Start-Class";
|
||||
|
||||
private static final String GIT_COMMIT_ATTRIBUTE = "Spring-Boot-Commit-Id";
|
||||
|
||||
private static final String GIT_COMMIT_PROPERTY = "git.commit.id";
|
||||
|
||||
private String mainClass;
|
||||
|
||||
private boolean backupSource = true;
|
||||
@ -176,6 +182,21 @@ public class Repackager {
|
||||
manifest.getMainAttributes().putValue(MAIN_CLASS_ATTRIBUTE,
|
||||
this.layout.getLauncherClassName());
|
||||
manifest.getMainAttributes().putValue(START_CLASS_ATTRIBUTE, startClass);
|
||||
Properties gitProperties = new Properties();
|
||||
try {
|
||||
InputStream resource = getClass().getResourceAsStream(
|
||||
"/org/springframework/boot/git.properties");
|
||||
if (resource != null) {
|
||||
gitProperties.load(resource);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
if (gitProperties.getProperty(GIT_COMMIT_PROPERTY) != null) {
|
||||
manifest.getMainAttributes().putValue(GIT_COMMIT_ATTRIBUTE,
|
||||
gitProperties.getProperty(GIT_COMMIT_PROPERTY));
|
||||
}
|
||||
return manifest;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Mon Oct 14 16:04:26 EDT 2013
|
||||
git.commit.id.abbrev=b0c54a6
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
|
||||
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
|
||||
git.commit.message.short=Add parent class loader entries if possible
|
||||
git.commit.user.name=Dave Syer
|
||||
git.build.user.name=Dave Syer
|
||||
git.build.user.email=dsyer@gopivotal.com
|
||||
git.branch=master
|
||||
git.commit.time=2013-10-14T16\:02\:04-0400
|
||||
git.build.time=2013-10-14T16\:04\:26-0400
|
@ -0,0 +1,13 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Mon Oct 14 16:04:25 EDT 2013
|
||||
git.commit.id.abbrev=b0c54a6
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
|
||||
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
|
||||
git.commit.message.short=Add parent class loader entries if possible
|
||||
git.commit.user.name=Dave Syer
|
||||
git.build.user.name=Dave Syer
|
||||
git.build.user.email=dsyer@gopivotal.com
|
||||
git.branch=master
|
||||
git.commit.time=2013-10-14T16\:02\:04-0400
|
||||
git.build.time=2013-10-14T16\:04\:25-0400
|
@ -0,0 +1,13 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Mon Oct 14 16:04:29 EDT 2013
|
||||
git.commit.id.abbrev=b0c54a6
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
|
||||
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
|
||||
git.commit.message.short=Add parent class loader entries if possible
|
||||
git.commit.user.name=Dave Syer
|
||||
git.build.user.name=Dave Syer
|
||||
git.build.user.email=dsyer@gopivotal.com
|
||||
git.branch=master
|
||||
git.commit.time=2013-10-14T16\:02\:04-0400
|
||||
git.build.time=2013-10-14T16\:04\:29-0400
|
Loading…
Reference in New Issue
Block a user