Manifest Files

JAR packaging is an important part of the ITAG Release Process.  In an effort to further the versioning of components, the manifest capabilities of JAR packaging are actively used to store and display versioning information.  Each deployable component is required to include a customized manifest file inside its JAR file containing versioning information.  This versioning information will be read at runtime and made available for everyone to view.  This will effectively provide a real-time display of all deployed components and their corresponding versions.  The required manifest template is shown below.

<manifest file="${manifest.file}">
       <section name="UCSD.ACT.ITAG properties">
              <attribute name="Build-Version"  value="${build.version}" />
              <attribute name="Build-Project"  value="${project.id}" />
              <attribute name="Build-Contents" value="${project.id} webapp" />
              <attribute name="Build-Date"     value="${build.time}" />
              <attribute name="Build-Maker"    value="${user.name}" />
       </section>
</manifest>

It’s important to keep in mind this is a template, you may use any variables you wish inside your build file so long as the values are populated correctly at build time. The examples below demonstrate use of the template as part of a build script.

Example Ant Integration Build Scripts

itag-build.properties   Example

This is all that is currently required in an ‘itag-build.properties’ file.  If a project doesn’t require a specific platform version, (perl projects for example), this property should be commented-out, although, the file must still exist.  This file is reserved for future use and so over time, its contents may evolve.  Please do not add extraneous properties to this file.

# This file is required by the ITAG Release Process.
#
# $Id: itag-build.properties 1099 2011-06-09 23:27:23Z devdss $
# this property defines the required platform version
itag.platform.version=0.1

Java WebApp Example

<target name="itag.build">
       <!-- optional initializations -->
       <tstamp>
              <format pattern="MMM dd, yyyy '@' h:mm a z" property="build.time"/>
       </tstamp>
      
       <!-- clean -->
       <delete includeemptydirs="true">
              <fileset dir="${basedir}/build" includes="**/*"/>
       </delete>
      
       <!-- compile -->
       <javac
              srcdir        ="${src.dir}"
              destdir       ="${build.dir}"
              sourcepathref ="sourcepath"
              debug         ="${debug}"
              verbose       ="${verbose}"
              optimize      ="${optimize}"
              nowarn        ="${nowarn}"
              target        ="${javac.target}"
              source        ="${javac.source}"
              compiler      ="${build.compiler}"
              failonerror   ="true">
              <classpath>
                     <path refid="itag.platform.path"/>
                     <fileset dir="${basedir}/root/WEB-INF/lib">
                           <include name="*.jar"/>
                     </fileset>
              </classpath>
       </javac>
 
       <!-- build WAR file -->
       <antcall target="build.war"/>
 
              <!-- wrap apol WAR file inside jar and copy to itag out directory -->
              <property name="manifest.file" value="${build.dir}/${webapp.name}.MF"/>
              <manifest file="${manifest.file}">
                     <section name="UCSD.ACT.ITAG properties">
                           <attribute name="Build-Version"  value="${build.version}" />
                           <attribute name="Build-Project"  value="${webapp.name}" />
                           <attribute name="Build-Contents" value="${webapp.name} webapp" />
                           <attribute name="Build-Date"     value="${build.time}" />
                           <attribute name="Build-Maker"    value="${user.name}" />
                     </section>
              </manifest>
              <jar destfile="${itag.out.dir}/apol.itag-webapp"
                     basedir="${build.dir}"
                     update="false"
                     duplicate="preserve"
                     manifest="${manifest.file}"
                     includes="${webapp.name}.war">
                     <zipfileset dir="${build.dir}"      includes="${webapp.name}.MF" prefix="META-INF/"/>
              </jar>
</target>

Perl Script Example

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: itag-build.xml 51 2011-06-08 15:58:55Z devdss $ -->
<project name="tritonlinkperl" default="usage" basedir=".">
  <property file="${basedir}/version.properties"/>
      
  <target name="usage">
    <echo>itag.build  ..........  integration target for ITAG release process</echo>
  </target>
      
  <target name="itag.build" depends="-itag.perl"/>
      
  <target name="-itag.perl">
    <!-- build initializations -->
    <tstamp>
      <format pattern="MMM dd, yyyy '@' h:mm a z" property="build.time"/>
    </tstamp>
             
    <!—clean build directory -->
    <delete dir="${build.dir}" quiet="true"/>
    <mkdir dir="${build.dir}"/>
             
    <!-- build jar -->
    <manifest file="${build.dir}/${app.name}.MF">
      <section name="UCSD.ACT.ITAG properties">
        <attribute name="Build-Version"  value="${version}" />
        <attribute name="Build-Project"  value="${app.name}" />
        <attribute name="Build-Contents" value="${app.name} perl scripts" />
        <attribute name="Build-Date"     value="${build.time}" />
        <attribute name="Build-Maker"    value="${user.name}" />
      </section>
    </manifest>
    <jar
      destfile="${build.dir}/${jarfile}"
      basedir="${basedir}"
      update="false"
      duplicate="preserve"
      manifest="${build.dir}/${app.name}.MF"
      includes="**/*.pl">
      <zipfileset dir="${build.dir}"      includes="${app.name}.MF"  prefix="META-INF/"/>
    </jar>
             
    <!-- copy to ITAG out dir -->
    <copy file="${build.dir}/${jarfile.name}" tofile="${itag.out.dir}/${jarfile}.itag-perl"/>
  </target>
</project>