Reputation: 1263
I have a module with some structure (src/com/mycompany). I need to generate part of code from xsd using jaxb. Also it's important to generate them on building stage. I need specify ant target for it.
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath path="${xjc.task.path}"/>
</taskdef>
<target name="schema-to-java">
<xjc destdir="./src/gen">
<schema dir="./META-INF/xsd" includes="**/*.xsd"/>
</xjc>
</target>
xjc.task.path - path to jaxb-2.0 directory.
src and META-INF are located on the same level (project dir)
Project builds successfully but no classes are generated
Upvotes: 2
Views: 4383
Reputation: 198
The reason why you don't have classes generated is because you don't compile your java source codes (i.e. .java).
xjc ant ask will just generate java source code. You need another ant task for generating classes which is the javac
Upvotes: 1