使用ant打包jar包时的class-path解决方法

Using Ant classpath in jar manifest
<path id="project.classpath">
    <pathelement location="${lib.dir}/foo.jar" />
    <pathelement location="${lib.dir}/bar.jar" />
</path>

<task name="jar">
  <!-- Convert project class path to string property -->
  <pathconvert property="mf.classpath" pathsep=" ">
    <path refid="project.classpath" />
    <flattenmapper />
  </pathconvert>

  <jar jarfile="${lib.dir}/${jar.app.name}"
       basedir="${build.app.dir}"
       index="true">
    <manifest>
      <attribute name="Created-By" value="${mf.created-by}" />
      <attribute name="Main-Class" value="${mf.main-class}" />
      <attribute name="Class-Path" value="${mf.classpath}" />
    </manifest>
  </jar>
</task>
把classpath中的jar包,转换成jar Class-Path格式

 上文来自:http://www.guydavis.ca/log/view.jsp?id=851

 

在关pathconvert的api参见:

http://www-rohan.sdsu.edu/doc/ant_1.7/CoreTasks/pathconvert.html

你可能感兴趣的:(html,jsp,ant)