ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject Re: [Bug 6857] - jar manifest copies mf files wrong
Date Fri, 22 Mar 2002 00:34:54 GMT
From: "Conor MacNeill" <conor@cortexebusiness.com.au>

> > 
> > I also think it is important to have a way to request that at least the 
> > classpath be left alone as a long line. There is too much code outthere that t 
> > does not follow this obscure spec. 
> 
> 
> I don't know if I would call it an obscure spec. Certainly the jar command that 
> comes with the JDK and the Manifest classes in the JDK follow the spec.
> 
Is this true for JDK 1.1?
The other point to take into account is that until J2EE and the real apperance of 
Class-Path as something to be used, people's code hardly looked at the manifest
entries. Now we have all these ClassLoaders implementations that need to look
at the manifest and the JDK did not provide the facilities to really isolate
users code from the encoding of manifests.

Now we have a bunch of bad behaved code that works fine is you just have one
or two things in the class-path but fails when people push it with large usages.

> > 
> > How about a "strict='true'" attribute that when true follows the 72 char split
> > and lives lines alone when false.
> 
> 
> Since the JDK jar command is behaving in the same way as the <manifest> code, 
> I'm not sure we should establish a less compliant approach.
> 
Is this the 1.1 behavior? I am really not sure.
> 
> > 
> > I know this is changing the subject a little, but it would be fantastic if we 
> > could add a <classpathset> fileset element that constructs the Class-Path
line
> > from a list of jars. I could provide a patch if people think it would be a good

> > idea.
> > 
> 
> 
> I had though of adding a <classpath> element and allowing it to take a reference

> to a Path object. Not sure I follow how you would do it. Can you expland on that?
> 

I would like to be able to say something like this:

    <manifest ....>
        <classpathset dir='mylibs'>
            <include name="lib/**/*.jar"/>
            <exclude name="lib/tests/**" />
        </classpathset>
    </manifest>

the result is a manifest entry that looks like:

    Class-Path: lib/lib1.jar lib/ext/lib2.jar lib/ext/lib3.jar

the entries are put relative to the fileset's dir and not absolute values,
just like the spec requires. Notice that the same fileset can be used
for the layout of the jars in foe example a EAR. So one could do:

        <fileset dir='mylibs' id='libs'>
            <include name="lib/**/*.jar"/>
            <exclude name="lib/tests/**" />
        </fileset>
        <jar filedest='dist/myjar.jar' srcdir='classes' >
            <manifest ...>
                <classpathset refid='libs'/>
            <manifest>
        </jar>
        <copy toDir='dist'>
            <fileset refid='libs'>
        </copy>

It is not named <classpath> because it is not a PATH as defined by ANT
but it is a set of file names to put in the manifest entry. So it should be 
either the above or <classpathfileset> but that is quite long.

I could try to provide the implementation if people think it is a good idea.

Jose Alberto



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message