我正在尝试使用来自 ant 的 xjc 编译器。构建成功,但没有生成任何内容。我的蚂蚁脚本如下:
<?xml version="1.0" encoding="UTF-8"?>
<project name="AutomateWithAnt" basedir=".">
<property file="build.properties"/>
<path id="compile.classpath">
<fileset dir="${lib.includes}" includes="*.jar"></fileset>
</path>
<target name="init" description="create java class">
</target>
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpathref="compile.classpath"/>
<!-- Generates the source code from the test.xsd schema using jaxb -->
<target name="option-generate" description="Generates the source code" depends="init">
<xjc schema="test.xsd" destdir="${generated-src.dir}" package="${generated-src.dir}">
<arg value="-Xcommons-lang" />
<arg value="-Xcommons-lang:ToStringStyle=SHORT_PREFIX_STYLE" />
<produces dir="${generated-src.dir}" includes="**/*.java" />
</xjc>
</target>
</project>
我的 build.properties 是:
lib.includes=lib/
generated-src.dir=/
我使用的是 java 1.6,并且我使用了 jaxb-sjc.jar。