You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Michael Salmon <ms...@formulae.org> on 2002/10/22 03:41:59 UTC

jar task, manifest issue

Hi folks,
    I need to use an existing MANIFEST.MF file in jar's I create.
Simply using <jar manifest="${manifest}"> where ${manifest} was a property 
pointing to an existing file did odd things. 
First off it would copy the MANIFEST.MF and rearrange the data in it and strip 
CRLF line feeds with unix style line feeds.
    Secondly the error from cvs code is
"[jar] File /usr/home/ms/src/java/j2me/bubble/.build/classes/META-INF/MANIFEST.MF includes a META-INF/MANIFEST.MF which will be ignored. To include this file, set filesetManifest to a value other than 'skip'."
The setFilesetManifest method is commented out though making setting this 
impossible. Personally I feel the value is overly specific and doesnt
make sense by it's (broken) code. Uncommenting the set method and setting
the value to "skip" does what I want, which is one way to fix the issue
but I would assume the code could use more cleanup then this.  So if someone
can fill me in on the filesetManifestConfig history I'd appreciate it.

thanks
ms




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jar task, manifest issue

Posted by Michael Salmon <ms...@formulae.org>.
I found where the second manifest was coming from, it wasnt
the compiler or ant making it luckily (because that would have been insane).

ms

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jar task, manifest issue

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 22 Oct 2002, Michael Salmon <ms...@formulae.org> wrote:

> Though I havent found it to be the case for manifest.mf files, it is
> easily possible that a phone could screw up.

Possible, yes.

> I dont see the reason why the data from a manifest is read into a
> hash and print it out (assuming that's how it's done) rather then
> simply copy the file retaining order.

Because Ant validates your manifest, may merge it with some other
manifests and even helps you by enforcing the specification (by
breaking lines that are too long, for example).

> Simply put: if I say I want to use file a for my manifest, changing
> that file in any way makes it a' which is not what I asked the tool
> to do.

The special handling of manifests is pretty much the only difference
between <jar> and <zip> (well, the encoding of filenames has different
default values as well).  If you trust you manifest file more than Ant
(and you may have good reasons to do so), you may be better of using
<zip>.

>> > To include this file, set filesetManifest to a value other than
>> > 'skip'."
>> 
>> This message should be gone in 1.5.1.
> 
> I am going off what is in cvs head.

Oops, will check.

> Currently "skip" is unsettable and not set by default (as the code
> says).

And cannot be set by default for backwards compatibility.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jar task, manifest issue

Posted by Michael Salmon <ms...@formulae.org>.
On Tue, Oct 22, 2002 at 08:22:09AM +0200, Stefan Bodewig wrote:
> On Mon, 21 Oct 2002, Michael Salmon <ms...@formulae.org> wrote:
> 
> > First off it would copy the MANIFEST.MF and rearrange the data in it
> > and strip CRLF line feeds with unix style line feeds.
> 
> order within a section is insignificant and the line ends are correct
> - all according to the manifest specification.
> 
> Is there a real problem with the rewritten manifest - apart from
> aesthetics, I mean.

I am building applications for j2me devices. Some of the device runtimes
simply suck. There are problems in motorola phones for example
where .jad file data (which is a text file nearly identical to a manifest)
is needed to be in a specific order. Though I havent found it to be
the case for manifest.mf files, it is easily possible that a phone could
screw up. I dont see the reason why the data from a manifest is read
into a hash and print it out (assuming that's how it's done) rather then 
simply copy the file retaining order.
Simply put: if I say I want to use file a for my manifest, changing that file
in any way makes it a' which is not what I asked the tool to do.

> > "[jar] File
> > /usr/home/ms/src/java/j2me/bubble/.build/classes/META-INF/MANIFEST.MF
> > includes a META-INF/MANIFEST.MF which will be ignored.
> 
> This means that you are including your manifest twice, once via the
> manifest attribute and once as part of the files that are to be added
> to the archive.  Exclude it from the later part.

Yes, ant does create a default manifest when I use the javac task with
the modern compiler. Then when I go to jar it and want to replace the
manifest it gives me an unexpected error.
I am only adding my manifest once. 
I could delete the file that ant creates for me before I jar but I think
that's wrong, it should only create the default manifest.mf file if I dont
explicitly add one to the jar.

> > To include this file, set filesetManifest to a value other than
> > 'skip'."
> 
> This message should be gone in 1.5.1.

I am going off what is in cvs head.

> > The setFilesetManifest method is commented out though making setting
> > this impossible.
> 
> It is going to come back in 1.6, there have been some problems with
> the implementation that we couldn't resolve before we released 1.5.

I think the default behavior when a user simply specifies a manifest
attribute to <jar> is that it will skip. Currently "skip" is unsettable
and not set by default (as the code says). I could easily give you
a patch to set that value but I think you could code it as easily
as inspecting and adding my patch.

> Stefan

ms

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jar task, manifest issue

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 21 Oct 2002, Michael Salmon <ms...@formulae.org> wrote:

> First off it would copy the MANIFEST.MF and rearrange the data in it
> and strip CRLF line feeds with unix style line feeds.

order within a section is insignificant and the line ends are correct
- all according to the manifest specification.

Is there a real problem with the rewritten manifest - apart from
aesthetics, I mean.

> "[jar] File
> /usr/home/ms/src/java/j2me/bubble/.build/classes/META-INF/MANIFEST.MF
> includes a META-INF/MANIFEST.MF which will be ignored.

This means that you are including your manifest twice, once via the
manifest attribute and once as part of the files that are to be added
to the archive.  Exclude it from the later part.

> To include this file, set filesetManifest to a value other than
> 'skip'."

This message should be gone in 1.5.1.

> The setFilesetManifest method is commented out though making setting
> this impossible.

It is going to come back in 1.6, there have been some problems with
the implementation that we couldn't resolve before we released 1.5.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>