Ant – how to get all files’ name in a specific folder

You’re on the right track, use manifestclasspath task. The jarfile attribute is used to create relative links to the jars contained in the fileset.

<manifestclasspath property="jar.classpath" jarfile="${client_work_dir}/HelloWorld.jar">
  <classpath>
    <fileset name="" dir="${client_work_dir}/lib" includes="*.jar"/>
  </classpath>
</manifestclasspath>

<jar jarfile="${client_deploy_dir}/HelloWorld.jar" basedir="${client_work_dir}/compiled">
    <manifest>
         <attribute name="Main-Class" value="HelloWorld.Main"/>
         <attribute name="Class-Path" value=""${jar.classpath}"/>
      </manifest>
   </jar>

Leave a Comment