Code Snippet

Just another Code Snippet site

[Maven] Generate custom build timestamp

Result will be stored in property : buildtimestamp

	<!-- Plugin to generate BUILD timestamp -->
	<plugin>
		<groupId>org.codehaus.groovy.maven</groupId>
		<artifactId>gmaven-plugin</artifactId>
		<version>1.0</version>
		<executions>
			<execution>
				<phase>validate</phase>
				<goals>
					<goal>execute</goal>
				</goals>
				<configuration>
					<source>
					 import java.util.Date 
					 import java.text.MessageFormat 
					 def vartimestamp = MessageFormat.format("{0,date,dd/MM/yyyy - HH:mm}", new Date()) 
					 project.properties['buildtimestamp'] = vartimestamp
					</source>
				</configuration>
			</execution>
		</executions>
	</plugin>

, ,


Leave a Reply

Your email address will not be published. Required fields are marked *