You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/06/29 09:29:16 UTC

DO NOT REPLY [Bug 47446] New: Manifest.MF when generated programmatically, generates un-usable Class-Path attribute.

https://issues.apache.org/bugzilla/show_bug.cgi?id=47446

           Summary: Manifest.MF when generated programmatically, generates
                    un-usable Class-Path attribute.
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: Garima.Bathla@gmail.com
                CC: Garima.Bathla@gmail.com


For my given project, I am trying to create standalone executable jars. And
because at the compile time I do not know what is the Class-Path for the
application jar being built, Class-Path is being set at the run-time and I
achieve this by extending the Jar task:



Code snippet:

String formattedManifestClassPath = "aaa.jar bbb.jar ccc.jar ddd.jar eee.jar
fff.jar ggg.jar hhh.jar iii.jar jjj.jar kkk.jar lll.jar mmm.jar nnn.jar ooo.jar
ppp.jar qqq.jar rrr.jar sss.jar ttt.jar uuu.jar vvv.jar www.jar xxx.jar yyy.jar
zzz.jar";

Manifest.Attribute classpathAttribute =
new Manifest.Attribute(Manifest.ATTRIBUTE_CLASSPATH,
formattedManifestClassPath);

manifest.addConfiguredAttribute(classpathAttribute);

Now the problem is that the Class-Path in MANIFEST.MF file (int the jar) is
generated as

Class-Path: aaa.jar bbb.jar ccc.jar ddd.jar eee.jar fff.jar ggg.jar hh
 h.jar iii.jar jjj.jar kkk.jar lll.jar mmm.jar nnn.jar ooo.jar ppp.jar
  qqq.jar rrr.jar sss.jar ttt.jar uuu.jar vvv.jar www.jar xxx.jar yyy.
 jar zzz.jar

So if you observe the last jar's on each line of Class-Path may or may-not get
split based on the write rules ( Manifest.MF only allows 71 characters on each
line and after 71 Character's thw Manifest.write() inserts \n and a space
character - this causes -in my example- hhh.jar to split over 2 lines hh \n
h.jar.

So when I try to run this jar via java - jar command, class-path is being
ignored because it is not formatted correctly. 

I have tried implementing hacks - but nothing works - This definitely is a bug
in the Manifest.write() method ( Method should insert \n logically such that it
is not splitting a jar name over multiple lines - or to make it more simple, on
each line there should only be one jar file name - class-path's can get really
long).

I will really appreciate if this can be fixed ASAP.

Thanks,
Garima.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47446] Manifest.MF when generated programmatically, generates un-usable Class-Path attribute.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47446


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Stefan Bodewig <bo...@apache.org>  2009-06-29 02:49:12 PST ---
Garima, 

you've already been told that the classpath entry inside the MANIFEST.MF is
correct on the mailing list - this is what the specification of the manifest
format says: no lines longer than 72 chars (including newline) with
continuation lines starting with a space.

If you classpath doesn't work it is *not* because of the formatting of the
classpath entry - unless the code reading the manifest was in violation of the
spec, that is.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.