diff --git a/src/main/groovy/nebula/plugin/info/basic/BasicInfoPlugin.groovy b/src/main/groovy/nebula/plugin/info/basic/BasicInfoPlugin.groovy
index 24421b6..03e3927 100644
--- a/src/main/groovy/nebula/plugin/info/basic/BasicInfoPlugin.groovy
+++ b/src/main/groovy/nebula/plugin/info/basic/BasicInfoPlugin.groovy
@@ -16,6 +16,7 @@ import static java.util.jar.Attributes.Name.*
*
Built-Status (project.status)
* Built-By (user.name)
* Build-Date
+ * Build-Date-Format
* Gradle-Version (project.gradle.gradleVersion)
*
*/
@@ -48,8 +49,10 @@ class BasicInfoPlugin implements Plugin, InfoCollectorPlugin {
manifestPlugin.add('Built-By', System.getProperty('user.name'))
manifestPlugin.add('Built-OS', System.getProperty('os.name'))
+ String buildDateFormat = "yyyy-MM-dd'T'HH:mm:ssXXX"
// Makes list of attributes not idempotent, which can throw off "changed" checks
- manifestPlugin.add('Build-Date', new Date().format('yyyy-MM-dd_HH:mm:ss')).changing = true
+ manifestPlugin.add('Build-Date', new Date().format(buildDateFormat)).changing = true
+ manifestPlugin.add('Build-Date-Format', buildDateFormat)
manifestPlugin.add('Gradle-Version', { project.gradle.gradleVersion })
diff --git a/src/test/groovy/nebula/plugin/info/reporting/InfoJarManifestPluginLauncherSpec.groovy b/src/test/groovy/nebula/plugin/info/reporting/InfoJarManifestPluginLauncherSpec.groovy
index 6ed7d54..033458a 100644
--- a/src/test/groovy/nebula/plugin/info/reporting/InfoJarManifestPluginLauncherSpec.groovy
+++ b/src/test/groovy/nebula/plugin/info/reporting/InfoJarManifestPluginLauncherSpec.groovy
@@ -4,6 +4,7 @@ import nebula.plugin.info.InfoBrokerPlugin
import nebula.plugin.info.basic.BasicInfoPlugin
import nebula.test.IntegrationSpec
+import java.text.SimpleDateFormat
import java.util.jar.Attributes
import java.util.jar.JarFile
import java.util.jar.Manifest
@@ -83,6 +84,12 @@ class InfoJarManifestPluginLauncherSpec extends IntegrationSpec {
assertMainfestKeyExists(attributes, 'Built-By')
assertMainfestKeyExists(attributes, 'Built-OS')
assertMainfestKeyExists(attributes, 'Build-Date')
+ assertMainfestKeyExists(attributes, 'Build-Date-Format')
+ // ensure that the Build-Date can be parsed and the parsed Date formats to the Build-Date
+ SimpleDateFormat sdf = new SimpleDateFormat(manifestKey(attributes, 'Build-Date-Format'))
+ String manifestBuildDate = manifestKey(attributes, 'Build-Date')
+ Date buildDate = sdf.parse(manifestBuildDate)
+ sdf.format(buildDate) == manifestBuildDate
assertMainfestKeyExists(attributes, 'Gradle-Version')
}