如何执行从ANT JAXB编译器 [英] How to execute the JAXB compiler from ANT

查看:311
本文介绍了如何执行从ANT JAXB编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的一个项目JAXB。 JAXB的吸引力在于它是捆绑在一起的JDK,我一直使用xjc.exe在命令行上生成从架构.java文件。我似乎无法找到JAXB ant任务,肯定有一个在下载 http://jaxb.java.net 但是我想使用捆绑到JDK的JAXB是有一些方法来调用JAXB从蚂蚁什么类并在xjc.exe呼吁?


解决方案

 <目标名称=生成-jaxb- code>
    < Java类名=com.sun.tools.internal.xjc.XJCFacade>
            < ARG值= - P/>
            < ARG值=com。示例/>
            < ARG值=XSD / sample.xsd/>
    < / JAVA>
< /目标与GT;

刚走到狩猎中的tools.jar,发现XJCFacade.class在com.sun.tools.internal测试上述code它的工作原理它产生的输出xjc.exe似乎XJC.exe调用此code com.sun.tools.internal.xjc.XJCFacade

我的一个关键要求是,Ant文件有Eclipse中工作,而不必包含路径名JDK这样的文件将是跨操作系统移植。我假设的tools.jar包含在通过安装的JRE preferences选项的类路径。

I am using JAXB on a project. the attraction of JAXB is that it is bundled with the JDK, I have been to use xjc.exe on the command line to generate the .java files from a schema. I can't seem to find the JAXB ant task, sure there is a download at http://jaxb.java.net however i want to use the JAXB that is bundled into the JDK is there some way to call JAXB from ant what class does the xjc.exe call on?

解决方案

<target name="generate-jaxb-code">
    <java classname="com.sun.tools.internal.xjc.XJCFacade">
            <arg value="-p" />
            <arg value="com.example"/>
            <arg value="xsd/sample.xsd" />
    </java>
</target>

Just went hunting in the tools.jar and found the XJCFacade.class in com.sun.tools.internal tested the above code it works it produces the output as xjc.exe It seems that XJC.exe calls this code com.sun.tools.internal.xjc.XJCFacade

One of my key requirements was that the ant file had work within eclipse without having to include a path name to the JDK that way the file would be portable across operating systems. I am assuming that tools.jar is included on the classpath via the installed JRE preferences options.

这篇关于如何执行从ANT JAXB编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆