So we configured the maven pom to execute the
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-war-plugin</artifactid>
<version>2.0.2</version>
<configuration>
<manifest>
<adddefaultimplementationentries>true</adddefaultimplementationentries>
</manifest>
<archive>
<manifestentries>
<specification-title>${project.name}</Specification-Title>
<specification-version>${project.version}</Specification-Version>
<implementation-version>${BUILD_TAG}</Implementation-Version>
<build-final-name>${project.build.finalName}</build-final-name>
</manifestentries>
</archive>
</configuration>
</plugin>
to ensure the data is saved inside the META-INF/MANIFEST.MF.
To show the data in the screen we relied upon the InputStreamPropertyEditor of the Spring framework defining a bean
<bean id="manifestFile" class="java.util.jar.Manifest">
<constructor-arg value="/META-INF/MANIFEST.MF" type="java.io.InputStream"/>
</bean>
and in the footer part of the facelets template we simply wrote:
hudson build tag: #{manifestFile.mainAttributes.getValue('implementation-version')}
Note: we used jboss-EL that allows evaluation of method calls.
No comments:
Post a Comment