Code Snippet

Just another Code Snippet site

[Maven] Manifest : Build Number & SVN Revision

Add information in the manifest :

	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-jar-plugin</artifactId>
		<version>2.4</version>
		<configuration>
			<archive>
				<manifestEntries>
					<Extension-Name>${project.name}</Extension-Name>
					<Implementation-Title>${project.name}</Implementation-Title>
					<Implementation-Version>${project.version}</Implementation-Version>
					<Implementation-Version-Date>${project.buildDate}</Implementation-Version-Date>
					<Implementation-Version-Build>${BUILD_NUMBER}</Implementation-Version-Build>
					<Implementation-Version-Revision>${env.SVN_REVISION}</Implementation-Version-Revision>
				</manifestEntries>
			</archive>
		</configuration>
	</plugin>

Display information during Jenkins build :

	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-antrun-plugin</artifactId>
		<version>1.1</version>
		<executions>
			<execution>
				<phase>initialize</phase>
				<goals>
					<goal>run</goal>
				</goals>
				<configuration>
					<tasks>
						<echo>-----------------------------------------------------------------------------------</echo>
						<echo>buildtimestamp            : ${buildtimestamp}</echo>
						<echo>Build Number              : ${BUILD_NUMBER}</echo>
						<echo>SVN Revision              : ${env.SVN_REVISION}</echo>
						<echo>-----------------------------------------------------------------------------------</echo>
					</tasks>
				</configuration>
			</execution>
		</executions>
	</plugin>

, ,


Comments are currently closed.