ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Automatic creation of manifest file
Date Sun, 29 Aug 2004 23:29:07 GMT
Dmitri Pissarenko wrote:
> Hello!
> Some of my applications, which I package as an executable jar file,
> depends on many other jar files.
> These jar files are located in a subdirectory of the directory, in which
> executable jar file resides.
> Using the manifest file inside it, the executable jar knows where to
> find all required classes.
> The required jar files, on which the executable jar depends, vary from
> build to build (because of newer versions). The manifest file must be
> always updated whenever the dependencies of the executable jar change.
> I want to write an ant task, which does the following:
> 1) Gets a list of all files in a certain directory (lib) with a certain
> extension (*.jar). This step is equivalent to running linux command "ls
> -1 lib/*.jar" and getting its output.
> 2) In the output of 1), newlines are replaced by spaces.
> 3) The result of 2) is put into the manifest file after "Class-Path".

You can do a few things with existing Ant tasks to achieve what you want.

e.g. use pathconvert with a fileset to get the classpath into a property

<pathconvert dirsep="/" pathsep=" " property="war.classpath">
   <map from="${}" to="lib"/>
     <fileset dir="${}">
       <include name="*xwork*"/>
       <include name="*webwork*"/>
       <include name="*velocity*"/>
       <include name="*ognl*"/>

and then

<war webxml="${appconf.dir}/web.xml" warfile="${war.file}">
     <attribute name="Class-Path" value="${war.classpath}"/>


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message