There is a task to add a record to the project version:

build yyyymmdd.HHmm 

When I do a project build, the program header is displayed, for example:

 build 20180710.1110 

After packing the program into the installer, the user rolls in the program and starts it, for example, he sees:

 build 20180711.0930 

And every time he starts the application again, the version will be updated with the current date and time, which is logical. My question is this: how to save the last build of the project automatically, without further updating? The option to rule the hands does not fit.

Addition:

I use Maven plugin - buildnumber-maven-plugin. It turned out to create a .properties file, in which the build number is written, each time increasing by 1. But I need to do the same with the date, I cannot display the current date. Tell me how to correct the plugin.

  <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.4</version> <executions> <execution> <id>buildnumber</id> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <format>${project.version};{0,number}</format> <items> <item>buildNumber</item> </items> <doCheck>false</doCheck> <doUpdate>false</doUpdate> <!--<revisionOnScmFailure>unknownbuild</revisionOnScmFailure>--> </configuration> </plugin> 
  • and through what you build? in gradle you can do it quite easily - Senior Pomidor
  • Maven. If you say how - I will be grateful - blueberry
  • Where do you initially get the version from? where is it stored? - Senior Pomidor
  • At the moment it is simply written in a variable. My method adds build to it yyyymmdd.HHmm - blueberry

0