日期:2014-05-20  浏览次数:20642 次

这个build.xml怎么写?
只编译工程中的某几个文件并且打包成jar文件
比如有两个类,
a1.aa1.CA1,和
a2.aa2.CA2
        <target   name= "compile "   depends= "init ">
                <javac   srcdir= "${src} "   destdir= "${classes} ">     ---------------这里怎么写?
                </javac>
        </target>

        <target   name= "bin "   depends= "compile ">
                <mkdir   dir= "${bin} "/>
                <jar   jarfile= "${bin}/DIYBingo.jar "   basedir= "${classes} ">   ------------这里怎么写?
                               
                </jar>
        </target>

------解决方案--------------------
ANT 的文档上,关于 javac 有这么一个属性

includes
Comma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all .java files are included when omitted.

比如有两个类,
a1.aa1.CA1,和
a2.aa2.CA2
那么:

<javac srcdir= "${src} "
destdir= "${build} "
includes= "a1.aa1.CA1,a2.aa2.CA2 "
/>

jar 也是一样的。