<project name="horizontal" default="javac" basedir="."> <description>Shows how multi-column report templates could be filled horizontally.</description> <property name="class.name" value="HorizontalApp" />
<property name="file.name" value="HorizontalReport" />
<property name="classes.dir" value="../../../build/classes" />
<property name="lib.dir" value="../../../lib" />
<property name="fonts.dir" value="../../fonts" />
<path id="classpath">
<pathelement location="./"/>
<pathelement location="${classes.dir}" />
<pathelement location="${fonts.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<target name="print" description="Sends the report in the .jrprint file to the printer.">
<java classname="${class.name}" fork="true">
<arg value="-Tprint"/>
<arg value="-F${file.name}.jrprint"/>
<classpath refid="classpath"/>
</java>
</target> <target name="pdf" description="Generates a PDF version of the report by converting the .jrprint file.">
<java classname="${class.name}" fork="true">
<arg value="-Tpdf"/>
<arg value="-F${file.name}.jrprint"/>
<classpath refid="classpath"/>
</java>
</target>
</project>
path 块构建了Ant 构建应用是要使用的classpath。它每次都会执行而不管是选择哪一个目标。通常,这是一个WEB-INF/lib 文件夹中的JAR的清单
target块构建了两个<java>任务,并提供了<arg>元素给指定的java文件传递value。
因为我是想在程序里面直接实现打印/生成PDF文件等这些功能.
<arg value="-Tpdf"/>
<arg value="-F${file.name}.jrprint"/>
<classpath refid="classpath"/>
</java>这样段代码是不是和直接在dos下运行是一样的?另外有没有中文的资料啊?
它新建一个进程来执行JAVA命令
另外,我有ANT的中英文资料,搂主写下你的EMAIL.
真是太谢谢了啊