This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Manifest destiny! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Manifest destiny!" Watch "Manifest destiny!" New topic
Author

Manifest destiny!

waluigi johnson
Greenhorn

Joined: Jun 14, 2006
Posts: 3
Hello everyone,

My problem is with creating a Manifest file in Ant. I require a completely unique manifest.mf file in my meta-inf folder.

Ant, by default creates this "manifet.mf" file:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.4
Created-By: 1.3.1_09-b03 (Sun Microsystems Inc.)

My deploy tool breaks unless the "manifest.mf" looks exactly like this:

Manifest-Version: 1.0
Implementation-Title: scem
Specification-Vendor: SAP AG
Implementation-Vendor-Id: sap.com
Implementation-Version: 2006.06.12.10.34.23

Here's what i'm doing:

<manifest file="${scem.dir}/META-INF/MANIFEST.MF" mode="replace">
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Implementation-Title" value="scem"/>
<attribute name="Specification-Vendor" value="SAP AG"/>
<attribute name="Implementation-Vendor-Id" value="sap.com"/>
<attribute name="Implementation-Version" value="2006.06.12.10.34.23"/>
</manifest>

<!-- Creates the .ear file -->
<jar jarfile="${war.dir}/${conPropDir}/${war.filename}.ear" manifest="${scem.dir}/META-INF/MANIFEST.MF">
<fileset dir="${war.dir}/${conPropDir}" includes="${war.filename}.war" />
<fileset dir="${scem.dir}" includes="META-INF/*.xml" />
</jar>

Unfortunately, the result is contcatenatation of the two to creat his "Manifest.mf":

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.4
Created-By: 1.3.1_09-b03 (Sun Microsystems Inc.)
Implementation-Title: z_scem
Specification-Vendor: SAP AG
Implementation-Vendor-Id: sap.com
Implementation-Version: 2006.06.12.10.34.23


Please help!

thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

I think that says something bad about your deploy tool, but one way around this problem is to build up your manifest.mf file by hand and use the zip task instead of the jar task. All a JAR is is a zipfile with a manifest in it, so the JAR task adds one for you.


Customer surveys are for companies who didn't pay proper attention to begin with.
waluigi johnson
Greenhorn

Joined: Jun 14, 2006
Posts: 3
Hi Tim,

Thanks for the reply. Unfortunately the deploy tool is from SAP.. and I cannot change it in any way!

I made the change to the build.xml like you suggested:

<!-- Creates the .ear file -->
<zip zipfile="${war.dir}/${conPropDir}/${war.filename}.ear">
<fileset dir="${war.dir}/${conPropDir}" includes="${war.filename}.war" />
<fileset dir="${scem.dir}" includes="META-INF/*.xml" />
<fileset dir="${scem.dir}" includes="META-INF/*.mf" />
</zip>

and believe it or not it, it still added the ANT header's to the resulting Manifest file. I believe anything that's added as meta-inf/manifest.mf, be it with the jar or zip task, is still modified by Ant. Perhaps there is another way to manually add a file using zip?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Waluigi,
Welcome to JavaRanch!

I did this by creating the jar the way Ant wanted to and then using the update attribute of <jar> to overwrite the manifest with the one I wanted.

[fix typo in html &lt;]
[ June 15, 2006: Message edited by: Jeanne Boyarsky ]

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
waluigi johnson
Greenhorn

Joined: Jun 14, 2006
Posts: 3
I got it working! Thanks for your help Jeanne.

Regards,
WJ
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
We are facing the same issue with deploying and EAR to SAP. Could anyone share the solution (build) you used to remove the Ant generated lines in the manifests?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

You guys need to yell at your vendors! From the Sun documentation:


Attributes which are not understood are ignored. Such attributes may include implementation specific information used by applications.


From http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Manifest

In the mean time, I don't see any options in Ant to keep it from adding its audit info, so that leaves you using the ZIP task in place of JAR, WAR, and EAR until your vendor gets with the spec.
 
 
subject: Manifest destiny!
 
Similar Threads
Hudson Ant SVN
Determine version of a struts.jar
Manifest Version Headers Appearing Out Of Order
Application Build ID what is it?
ANT - MANIFEST.MF