public static void storeTimestamp ( File tsFile , Date buildDate ) throws MojoExecutionException { try { if ( tsFile . exists ( ) ) { tsFile . delete ( ) ; } File dir = tsFile . getParentFile ( ) ; if ( ! dir . exists ( ) ) { if ( ! dir . mkdirs ( ) ) { throw new MojoExecutionException ( "Cannot create directory " + dir ) ; } } FileUtils . fileWrite ( tsFile , StandardCharsets . US_ASCII . name ( ) , Long . toString ( buildDate . getTime ( ) ) ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "Cannot create " + tsFile + " for storing time " + buildDate . getTime ( ) , e ) ; } }
create a timestamp file holding time in epoch seconds