Java蚂蚁的任务要提取一些类常数



我需要一个蚂蚁任务,将某些类常数导出到文本文件。是可能的还是我可以写出该类的主要方法,并从ant称其为?

在这里已经回答了一些问题(例如,蚂蚁loadProperties失败(bcel error?))您可以使用给定的摘要读取类常数。为了运行此操作,您需要在Ant Class Path中使用Apache Bcel库(http://commons.apache.org/proper/commons-bcel/dypard/commons-bcel/fcommons-1)。" Echoproperties"将首先打印您的属性。如果您在其中找到var,则可以尝试将所需的var呼应到文件中(Echo任务可以执行此操作)。对我来说,这仅在Java 7中才起作用。

<target name="printVars">
<loadproperties encoding="iso-8859-1" srcfile="MyClass.class">
    <filterchain>
        <classconstants/>
    </filterchain>
</loadproperties>
<echoproperties/>
</target>

最新更新