Reputation: 6619
Why does grails war
generate a different WAR file every time? In the command line, I observe the following behavior.
$ grails test war
| Done creating WAR target/foo-2.5.3.war
MacBook-Air:foo mba$ md5 target/foo-2.5.3.war
MD5 (target/foo-2.5.3.war) = af45e22b24d158a72c9a0db67cd31417
$ grails test war
| Done creating WAR target/foo-2.5.3.war
MacBook-Air:foo mba$ md5 target/foo-2.5.3.war
MD5 (target/foo-2.5.3.war) = 157635f7d152cb56bc3b5bd731a8fb6e
Without changing a thing, all I did was run the same grails test war
command twice in a row. The WAR file generated from the second run has a different MD5 checksum than the first. Can anyone help me understand why? For what it's worth I'm running Grails 2.5.0.
Upvotes: 0
Views: 145
Reputation: 19682
When Grails generates a war it inserts or updates timestamps in several places with a default application (grails create-app foo
-> grails war
).
There are timestamps in:
application.properties
views.properties
manifest.properties
Additionally, the ordering of strings in some of these properties files is not guaranteed, so some lines appear in different order on subsequent runs.
Here's the full diff I got:
diff -ru tmp1/ tmp2/
diff -ru tmp1/WEB-INF/classes/application.properties tmp2/WEB-INF/classes/application.properties
--- tmp1/WEB-INF/classes/application.properties 2016-05-23 16:36:44.000000000 -0400
+++ tmp2/WEB-INF/classes/application.properties 2016-05-23 16:37:24.000000000 -0400
@@ -1,4 +1,4 @@
-#Mon, 23 May 2016 16:36:43 -0400
+#Mon, 23 May 2016 16:37:24 -0400
#Grails Metadata file
#Mon May 23 16:35:56 EDT 2016
app.grails.version=2.5.1
diff -ru tmp1/WEB-INF/classes/gsp/views.properties tmp2/WEB-INF/classes/gsp/views.properties
--- tmp1/WEB-INF/classes/gsp/views.properties 2016-05-23 16:36:42.000000000 -0400
+++ tmp2/WEB-INF/classes/gsp/views.properties 2016-05-23 16:37:22.000000000 -0400
@@ -1,8 +1,8 @@
#Precompiled views for databaseMigration
-#Mon May 23 16:36:42 EDT 2016
+#Mon May 23 16:37:21 EDT 2016
/WEB-INF/plugins/database-migration-1.4.0/grails-app/views/dbdoc/_overview-summary.gsp=gsp_databaseMigration_dbdoc_overview_summary_gsp
-/WEB-INF/plugins/database-migration-1.4.0/grails-app/views/dbdoc/_stylesheet.gsp=gsp_databaseMigration_dbdoc_stylesheet_gsp
/WEB-INF/plugins/database-migration-1.4.0/grails-app/views/dbdoc/_index.gsp=gsp_databaseMigration_dbdoc_index_gsp
+/WEB-INF/plugins/database-migration-1.4.0/grails-app/views/dbdoc/_stylesheet.gsp=gsp_databaseMigration_dbdoc_stylesheet_gsp
/WEB-INF/grails-app/views/index.gsp=gsp_5index_gsp
/WEB-INF/plugins/database-migration-1.4.0/grails-app/views/dbdoc/_globalnav.gsp=gsp_databaseMigration_dbdoc_globalnav_gsp
/WEB-INF/grails-app/views/layouts/main.gsp=gsp_5_layoutsmain_gsp
diff -ru tmp1/assets/manifest.properties tmp2/assets/manifest.properties
--- tmp1/assets/manifest.properties 2016-05-23 16:36:54.000000000 -0400
+++ tmp2/assets/manifest.properties 2016-05-23 16:37:26.000000000 -0400
@@ -1,5 +1,5 @@
#
-#Mon May 23 16:36:53 EDT 2016
+#Mon May 23 16:37:25 EDT 2016
apple-touch-icon-retina.png=apple-touch-icon-retina-21d524e96ee946f16c9b8fb4ea0c3f6e.png
skin/information.png=skin/information-3750c701d2ec35a45d289b9b9c1a0667.png
skin/database_add.png=skin/database_add-82a75143b4660a3f02f9c058f0a3ae93.png
@@ -20,9 +20,9 @@
errors.css=errors-81f3e38a6e878acd57e3d51912c37b04.css
main.css=main-46ae5880f56b5942fc138e25d2f87c47.css
jquery/jquery-1.11.1.min.map=jquery/jquery-1.11.1.min-ffbeb16578d8cdf58104889baacbbef2.map
-favicon.ico=favicon-9ef27019cc7a636e29ecc851528f716e.ico
skin/database_save.png=skin/database_save-8303213a3c95654e14d5afd4e72ed4c2.png
-skin/sorted_desc.gif=skin/sorted_desc-b85986b88116c4b0ef7571a1c4f3cfa3.gif
+favicon.ico=favicon-9ef27019cc7a636e29ecc851528f716e.ico
grails_logo.png=grails_logo-eabe4af98753b0163266d7e68bbd32e3.png
+skin/sorted_desc.gif=skin/sorted_desc-b85986b88116c4b0ef7571a1c4f3cfa3.gif
jquery/jquery-1.11.1.min.js=jquery/jquery-1.11.1.min-ac124bf54878ec7f20b578d3e627d6a8.js
skin/house.png=skin/house-99bea32e1990e011e870f6c562e87a6a.png
Upvotes: 1