Remove Git plugin from Spring Boot tools
The Git plugin was primarily being used to provide version information that Boot's maven plugin can add into the MANIFEST.MF of the uber-jars that it creates under the Spring-Boot-Commit-Id attribute. This commit removes the Git plugin from Boot's own projects, but leaves it in the spring-boot-starter-parent for use by Spring Boot-based applications. The attribute in the uber-jars' MANIFEST.MF has been replaced with a Spring-Boot-Version attribute. The value of this attribute is the implementation version of Repackager class's package.
This commit is contained in:
@@ -563,11 +563,6 @@
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>1.9</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
@@ -19,25 +19,4 @@
|
||||
<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>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Wed Oct 16 13:12:16 EDT 2013
|
||||
git.commit.id.abbrev=47cd5dd
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Tooling for PropertiesLauncher in JAR archives\n\nTo use PropertiesLauncher instead of JarLauncher in an\nexecutable JAR we have provided tooling support. In Maven\n(using the starter parent to default some of the settings)\:\n\n <plugin>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-maven-plugin</artifactId>\n <configuration>\n <layout>ZIP</layout>\n </configuration>\n </plugin>\n\nin Gradle\:\n\n apply plugin\: "spring-boot"\n springBoot {\n layout \= 'ZIP'\n }\n }\n\n[Fixes \#58837492] [bs-330] Add tooling for PropertiesLauncher\n
|
||||
git.commit.id=47cd5dd679ce10f95aaa795cdec7314189ab3c7c
|
||||
git.commit.message.short=Tooling for PropertiesLauncher in JAR archives
|
||||
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-16T08\:49\:51-0400
|
||||
git.build.time=2013-10-16T13\:12\:16-0400
|
||||
@@ -18,8 +18,6 @@ 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;
|
||||
|
||||
@@ -35,9 +33,7 @@ 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 static final String BOOT_VERSION_ATTRIBUTE = "Spring-Boot-Version";
|
||||
|
||||
private String mainClass;
|
||||
|
||||
@@ -182,21 +178,10 @@ 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));
|
||||
}
|
||||
|
||||
String bootVersion = getClass().getPackage().getImplementationVersion();
|
||||
manifest.getMainAttributes().putValue(BOOT_VERSION_ATTRIBUTE, bootVersion);
|
||||
|
||||
return manifest;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Wed Oct 16 13:12:08 EDT 2013
|
||||
git.commit.id.abbrev=47cd5dd
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Tooling for PropertiesLauncher in JAR archives\n\nTo use PropertiesLauncher instead of JarLauncher in an\nexecutable JAR we have provided tooling support. In Maven\n(using the starter parent to default some of the settings)\:\n\n <plugin>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-maven-plugin</artifactId>\n <configuration>\n <layout>ZIP</layout>\n </configuration>\n </plugin>\n\nin Gradle\:\n\n apply plugin\: "spring-boot"\n springBoot {\n layout \= 'ZIP'\n }\n }\n\n[Fixes \#58837492] [bs-330] Add tooling for PropertiesLauncher\n
|
||||
git.commit.id=47cd5dd679ce10f95aaa795cdec7314189ab3c7c
|
||||
git.commit.message.short=Tooling for PropertiesLauncher in JAR archives
|
||||
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-16T08\:49\:51-0400
|
||||
git.build.time=2013-10-16T13\:12\:08-0400
|
||||
@@ -18,6 +18,7 @@ package org.springframework.boot.loader.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.zip.ZipEntry;
|
||||
@@ -27,11 +28,6 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.springframework.boot.loader.tools.Layout;
|
||||
import org.springframework.boot.loader.tools.Libraries;
|
||||
import org.springframework.boot.loader.tools.LibraryCallback;
|
||||
import org.springframework.boot.loader.tools.LibraryScope;
|
||||
import org.springframework.boot.loader.tools.Repackager;
|
||||
import org.springframework.boot.loader.tools.sample.ClassWithMainMethod;
|
||||
import org.springframework.boot.loader.tools.sample.ClassWithoutMainMethod;
|
||||
|
||||
@@ -258,6 +254,18 @@ public class RepackagerTests {
|
||||
equalTo("testLauncher"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBootVersion() throws Exception {
|
||||
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
|
||||
File file = this.testJarFile.getFile();
|
||||
Repackager repackager = new Repackager(file);
|
||||
repackager.repackage(NO_LIBRARIES);
|
||||
Manifest actualManifest = getManifest(file);
|
||||
assertThat(
|
||||
actualManifest.getMainAttributes().containsKey(
|
||||
new Attributes.Name("Spring-Boot-Version")), equalTo(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullCustomLayout() throws Exception {
|
||||
this.testJarFile.addClass("a/b/C.class", ClassWithoutMainMethod.class);
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Wed Oct 16 13:12:06 EDT 2013
|
||||
git.commit.id.abbrev=47cd5dd
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Tooling for PropertiesLauncher in JAR archives\n\nTo use PropertiesLauncher instead of JarLauncher in an\nexecutable JAR we have provided tooling support. In Maven\n(using the starter parent to default some of the settings)\:\n\n <plugin>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-maven-plugin</artifactId>\n <configuration>\n <layout>ZIP</layout>\n </configuration>\n </plugin>\n\nin Gradle\:\n\n apply plugin\: "spring-boot"\n springBoot {\n layout \= 'ZIP'\n }\n }\n\n[Fixes \#58837492] [bs-330] Add tooling for PropertiesLauncher\n
|
||||
git.commit.id=47cd5dd679ce10f95aaa795cdec7314189ab3c7c
|
||||
git.commit.message.short=Tooling for PropertiesLauncher in JAR archives
|
||||
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-16T08\:49\:51-0400
|
||||
git.build.time=2013-10-16T13\:12\:06-0400
|
||||
@@ -1,13 +0,0 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Wed Oct 16 13:12:11 EDT 2013
|
||||
git.commit.id.abbrev=47cd5dd
|
||||
git.commit.user.email=dsyer@gopivotal.com
|
||||
git.commit.message.full=Tooling for PropertiesLauncher in JAR archives\n\nTo use PropertiesLauncher instead of JarLauncher in an\nexecutable JAR we have provided tooling support. In Maven\n(using the starter parent to default some of the settings)\:\n\n <plugin>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-maven-plugin</artifactId>\n <configuration>\n <layout>ZIP</layout>\n </configuration>\n </plugin>\n\nin Gradle\:\n\n apply plugin\: "spring-boot"\n springBoot {\n layout \= 'ZIP'\n }\n }\n\n[Fixes \#58837492] [bs-330] Add tooling for PropertiesLauncher\n
|
||||
git.commit.id=47cd5dd679ce10f95aaa795cdec7314189ab3c7c
|
||||
git.commit.message.short=Tooling for PropertiesLauncher in JAR archives
|
||||
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-16T08\:49\:51-0400
|
||||
git.build.time=2013-10-16T13\:12\:11-0400
|
||||
Reference in New Issue
Block a user