XJC与Krasa插件

时间:2013-11-05 08:06:19

标签: ant jaxb xjc

我执行以下ant脚本时遇到构建错误。有人可以帮我解决问题吗?

ANT输出:

Buildfile: D:\workspace\Webformular2\WebContent\WEB-INF\XSD-Pfad.ant 

[delete] Deleting directory D:\workspace\Webformular2\WebContent\WEB-INF\src 
[mkdir] Created dir: D:\workspace\Webformular2\WebContent\WEB-INF\src xjc: 
[xjc] Consider using <depends>/<produces> so that XJC won't do unnecessary compilation
[xjc] Compiling file:/D:/workspace/Webformular2/WebCo ntent/WEB-INF/jaxb/antragsdaten.xsd and others

BUILD FAILED D:\workspace\Webformular2\WebContent\WEB-INF\XSD-Pfad.ant:11: java.lang.NoClassDefFoundError: javax/validation/constraints/NotNull

Ant脚本

<project default="xjc">
        <delete dir="src"/>
        <mkdir dir="src" />
        <target name="xjc" description="JAXB Generation">
                <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
                  <classpath>
                    <fileset dir="lib" includes="*.jar" />
                  </classpath>
                </taskdef>`
`
                <xjc destdir="src" extension="true">
                        <schema  dir="jaxb" includes="*.xsd"/>
                        <arg line="
                                        -XJsr303Annotations
                                        -XReplacePrimitives"/>
                </xjc>
        </target>
</project>`

2 个答案:

答案 0 :(得分:0)

------- Ant-Skript --------- <project default="xjc"> <delete dir="src"/> <mkdir dir="src" /> <target name="xjc" description="JAXB Generation"> <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"> <classpath> <fileset dir="lib" includes="*.jar" /> </classpath> </taskdef> <xjc destdir="src" extension="true"> <schema dir="jaxb" includes="*.xsd"/> <arg line=" -XJsr303Annotations -XReplacePrimitives"/> </xjc> </target> </project>

答案 1 :(得分:0)

您错过了&#34; validation-api.jar&#34;在你的lib目录中。

参考: