You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David TROGDON <Da...@na.biomerieux.com> on 2004/10/04 21:49:58 UTC

manifest problems

Following is the "jar" target in my build file

<target name="jar">
            <mkdir dir="${build.filter.dir}/meta-inf"/>
            <copy file="${build.resources.dir}/MANIFEST.MF" todir="
${build.filter.dir}/meta-inf"/>
            <jar jarfile="${build.filter.dir}/O2.jar" basedir="
${build.filter.dir}">
                   <fileset dir="${build.filter.dir}/com/"
                        includes="${build.filter.dir}/*.wav,
${build.filter.dir}/*.gif,${build.filter.dir}/*.xml"
                   />
                   <fileset dir="${build.filter.dir}/org/"/>
                   <fileset dir="${build.filter.dir}/pv/"/>
                   <fileset dir="${build.filter.dir}/na/"/>
                  <fileset dir="${build.filter.dir}/meta-inf/"/>

            </jar>
            <delete dir="${build.filter.dir}/com"/>
            <delete dir="${build.filter.dir}/org"/>
            <delete dir="${build.filter.dir}/pv"/>
            <delete dir="${build.filter.dir}/na"/>
            <delete dir="${build.filter.dir}/meta-inf"/>
            <delete>
                  <fileset dir="${build.filter.dir}" includes="*.wav,*.gif,
*.xml"/>
            </delete>
            <antcall target="ISfilter"/>
</target>



As you can most likely determine:

In my build directory I:
create a meta-inf directory
copy my manifest.mf file into the directory
jar this directory and and 4 others along with a few files into O2.jar
I then delete everything I just put into the O2.jar


The problem is I end up with TWO maifest.mf files.
One in the O2.jar ROOT that contains the needed classpaths I need and a
second one in the meta-inf directory that is aparantly generated by the jar
function that has no classpaths.


This is what I copy into ${build.filter.dir}/meta-inf/ and ends up in
O2.jar root

Manifest-Version: 1.2
Main-Class: na.biomerieux.stagville.bootstrap.BootStrap
Class-Path: FastObjects_7JC_SDK.jar xreport_lite.jar
 xtools.jar JavaMediaFramework.jar JSEClassLibraries.jar
 jcchart.jar jctable.jar spring.jar spring-dao.jar
 commons-collections-2.0.jar commons-logging.jar
 BCICorba.jar vbjorb.jar lm.jar vbsec.jar


This is what ends up in ${build.filter.dir}/meta-inf/

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: 1.4.1_01-b01 (Sun Microsystems Inc.)


I intially started by specifying the manifest file but ANT truncates the
lines at exactally 70 characters no matter how I format it and the
classpath ends up bad.

Any help on how I might clear this up would be appreciated.

David T.













---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: manifest problems

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
David TROGDON wrote:
> 
> I intially started by specifying the manifest file but ANT truncates the
> lines at exactally 70 characters no matter how I format it and the
> classpath ends up bad.
> 
> Any help on how I might clear this up would be appreciated.
> 

Read this:
http://ant.apache.org/faq.html#mangled-manifest

On a recent bug report, I attached a small bit of code to print out the 
manifest classpath from a Jar to show that the 70 char limit is not a 
problem.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31251

My advice would be to back to doing it properly and determine why the 
classpath as you specify it is not working.

As to your specific issue, you are including the manifest as

<fileset dir="${build.filter.dir}/meta-inf/"/>

That's going to put that manifest file in the jar root, as you observe. 
You need to do this as

<fileset dir="${build.filter.dir}">
   <include name="meta-inf/*"/>
</fileset>

to retain the relative path in the jar. Once you do that, I think the 
jar command will probably process the manifest anyway, getting you back 
to the 70 char issue.

If you *really* want to build the jar manually, you need to use the 
<zip> task and then you'll need to start getting your case right - i.e. 
META-INF, not meta-inf. You don't want to go here.

Conor








---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org