ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47446] New: Manifest.MF when generated programmatically, generates un-usable Class-Path attribute.
Date Mon, 29 Jun 2009 07:29:16 GMT
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.

Mime
View raw message