mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Revert "Re-add Spring-Boot-Commit-Id to MANIFEST.MF of created jars"
This reverts commit 498ca07698
.
Removed due to eclipse failures.
This commit is contained in:
parent
aede0165a0
commit
18147b24c0
@ -80,44 +80,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<executable>git</executable>
|
||||
<arguments>
|
||||
<argument>log</argument>
|
||||
<argument>--pretty=format:Spring-Boot-Commit-Id: %H</argument>
|
||||
<argument>-n1</argument>
|
||||
</arguments>
|
||||
<outputFile>${project.build.directory}/build-number.mf</outputFile>
|
||||
<successCodes>
|
||||
<!-- Skip failures due to missing Git or the project not being a Git repo
|
||||
(needed for add-ons which ultimately extend this POM but don't use Git) -->
|
||||
<successCode>0</successCode>
|
||||
<successCode>1</successCode>
|
||||
<successCode>127</successCode>
|
||||
<successCode>128</successCode>
|
||||
</successCodes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.directory}/build-number.mf</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -18,10 +18,8 @@ package org.springframework.boot.loader.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
/**
|
||||
* Utility class that can be used to repackage an archive so that it can be executed using
|
||||
@ -36,8 +34,6 @@ public class Repackager {
|
||||
private static final String START_CLASS_ATTRIBUTE = "Start-Class";
|
||||
|
||||
private static final String BOOT_VERSION_ATTRIBUTE = "Spring-Boot-Version";
|
||||
|
||||
private static final String GIT_COMMIT_ATTRIBUTE = "Spring-Boot-Commit-Id";
|
||||
|
||||
private String mainClass;
|
||||
|
||||
@ -185,28 +181,6 @@ public class Repackager {
|
||||
|
||||
String bootVersion = getClass().getPackage().getImplementationVersion();
|
||||
manifest.getMainAttributes().putValue(BOOT_VERSION_ATTRIBUTE, bootVersion);
|
||||
|
||||
String gitCommitHash = null;
|
||||
JarFile jarFile = null;
|
||||
try {
|
||||
URL classContainer = getClass().getProtectionDomain().getCodeSource().getLocation();
|
||||
if (classContainer.toString().endsWith(".jar")) {
|
||||
jarFile = new JarFile(new File(classContainer.toURI()), false);
|
||||
ZipEntry manifestEntry = jarFile.getEntry("META-INF/MANIFEST.MF");
|
||||
gitCommitHash = new Manifest(jarFile.getInputStream(manifestEntry)).
|
||||
getMainAttributes().getValue(GIT_COMMIT_ATTRIBUTE);
|
||||
}
|
||||
} catch (Exception ignoreAndMoveOn) { }
|
||||
finally {
|
||||
if (jarFile != null) {
|
||||
try { jarFile.close(); }
|
||||
catch (IOException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (gitCommitHash != null && gitCommitHash.length() > 0) {
|
||||
manifest.getMainAttributes().putValue(GIT_COMMIT_ATTRIBUTE, gitCommitHash);
|
||||
}
|
||||
|
||||
return manifest;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user