0

Relatively new to Maven and was wondering if there is a way to generate a text file using Maven where the date in the file is the date that it was built?

My goal is to create a text file either inside or beside the packaged WAR file containing the date it was built.

Thanks in advance!

stef52
  • 1,089
  • 2
  • 15
  • 23
  • Try this one, with properties file,it should work fine :) http://stackoverflow.com/questions/1524824/how-can-i-in-a-jsp-page-get-maven-project-version-number – ppysz Aug 18 '14 at 13:09
  • And use this answer to get a timestamp: http://stackoverflow.com/questions/13228472/how-to-acces-maven-build-timestamp-for-resource-filtering – Tome Aug 18 '14 at 13:24
  • @Czarny Thanks, really helped me learn and understand the resources and filtering. – stef52 Aug 18 '14 at 16:50

1 Answers1

1

This sort of info would probably best go into the manifest. You can customize your manifest easily in Maven. If you really want a simple file, either generate one using e.g. the Project properties plugin or filter an existing one (in src/main/resources by default). To get the date value, use this.

kaqqao
  • 12,984
  • 10
  • 64
  • 118
  • What is a `Manifest` and what's its purpose? Couldn't it be simply replaced with a `.property` file? – stef52 Aug 18 '14 at 16:52
  • Manifests contain various meta-data about the artifact. They're a standard feature in Java and are well documented at http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html If you want a .properties file, I explained how to generate one and how to include the timestamp. Please accept my answer if it resolved your question. – kaqqao Aug 18 '14 at 20:48