diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index e8eed40606..d139e8f12d 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -563,11 +563,6 @@ versions-maven-plugin 2.0 - - pl.project13.maven - git-commit-id-plugin - 1.9 - diff --git a/spring-boot-tools/pom.xml b/spring-boot-tools/pom.xml index 6365a4eafa..ff57ff49f3 100644 --- a/spring-boot-tools/pom.xml +++ b/spring-boot-tools/pom.xml @@ -19,25 +19,4 @@ spring-boot-maven-plugin spring-boot-gradle-plugin - - - - pl.project13.maven - git-commit-id-plugin - - - - revision - - - - - true - yyyy-MM-dd'T'HH:mm:ssZ - true - src/main/resources/org/springframework/boot/git.properties - - - - diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/resources/org/springframework/boot/git.properties b/spring-boot-tools/spring-boot-gradle-plugin/src/main/resources/org/springframework/boot/git.properties deleted file mode 100644 index 50b4120318..0000000000 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/resources/org/springframework/boot/git.properties +++ /dev/null @@ -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 \n org.springframework.boot\n spring-boot-maven-plugin\n \n ZIP\n \n \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 diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java index 6133b637f8..87742d4d07 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java @@ -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; } diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/git.properties b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/git.properties deleted file mode 100644 index 18427e6d80..0000000000 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/git.properties +++ /dev/null @@ -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 \n org.springframework.boot\n spring-boot-maven-plugin\n \n ZIP\n \n \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 diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java index 835f798d7c..3cf4c69c4a 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java @@ -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); diff --git a/spring-boot-tools/spring-boot-loader/src/main/resources/org/springframework/boot/git.properties b/spring-boot-tools/spring-boot-loader/src/main/resources/org/springframework/boot/git.properties deleted file mode 100644 index 7a6ce83a31..0000000000 --- a/spring-boot-tools/spring-boot-loader/src/main/resources/org/springframework/boot/git.properties +++ /dev/null @@ -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 \n org.springframework.boot\n spring-boot-maven-plugin\n \n ZIP\n \n \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 diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/resources/org/springframework/boot/git.properties b/spring-boot-tools/spring-boot-maven-plugin/src/main/resources/org/springframework/boot/git.properties deleted file mode 100644 index 1a48e6e55b..0000000000 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/resources/org/springframework/boot/git.properties +++ /dev/null @@ -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 \n org.springframework.boot\n spring-boot-maven-plugin\n \n ZIP\n \n \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