dev@fi.java.net

Re: FYI: how to put build id into a jar

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 05 Aug 2005 16:21:06 +0200

Hi Kohsuke,

Thanks, that all worked quite nicely. Just checked the latest build and
the MANIFEST.MF is:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.4.2-b28 (Sun Microsystems Inc.)
Specification-Title: ITU-T Rec. X.891 | ISO/IEC 24824-1 (Fast Infoset)
Specification-Version: 1.0
Implementation-Title: Fast Infoset Implementation
Implementation-Version: 1.0.1
Implementation-Vendor: Sun Microsystems, Inc.
Implementation-Vendor-Id: com.sun
Extension-Name: com.sun.xml.fastinfoset
Build-Id: hudson-fi-349

Paul.

Kohsuke Kawaguchi wrote:
>
> I modified the Hudson configuration to pass in "build.id" property to
> the Ant build. So the rest is just to hook it up to the jar task.
>
> In JAXB RI, we have:
>
> <!-- this property is used by "xjc -version" and is also set in
> each of the
> generated ObjectFactory classes. It should be set via the
> RE build
> scripts via 'ant -Dbuild.id="b08"' otherwise the current
> date and time
> will be used -->
> <tstamp>
> <format property="now" pattern="MM/dd/yyyy hh:mm aa"
> unit="hour"/>
> </tstamp>
> <property name="build.id" value="${now}(${user.name})" />
> <property name="build.version"
> value="${release.impl.version}-${build.id}-${release.impl.version.suffix}"
> />
> <echo message="The build id is: ${build.version}" />
>
>
> Then use the following task to put this into the manifest:
>
> <manifest mode="update"
> file="${runtime.root}/build/manifest.rt">
> <section name="com.sun.xml.bind.v2.runtime">
> <attribute name="Implementation-Version"
> value="${build.version}" />
> </section>
> </manifest>
>
> This makes sure that the property is set to some value no matter where
> it run (RE and Hudson gets serial numbers.)
>
> This can be obtained as:
>
> // any class in the com.sun.xml.bind.v2.runtime package
> JAXBContextImpl.class.getPackage().getImplementationVersion()
>
> We also bake this into Messages.properties so that "xjc -version" prints
> this build id. We also define a method on JAXBContext that returns this
> value.
>
>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109