JIBX - проблема со скриптом муравья - PullRequest
2 голосов
/ 13 марта 2012

У меня проблема с jibx и созданием jar. Я использую Netbeans IDE.

В build.xml у меня есть:

<import file="nbproject/jibx.xml"/>
<import file="nbproject/build-impl.xml"/>
<target name="-pre-compile" depends="jibx-bind"/>
<target name="-post-compile"  depends="jibx-postcompile">
    <copy toDir="${basedir}/${build.dir}/classes" overwrite="true">
        <fileset dir="${basedir}/${build.dir}/jibx/classes">
            <include name="**/*"/>
        </fileset>
    </copy>
</target>

<target name="-pre-jar"  depends="jibx-postcompile">
    <copy toDir="${basedir}/${build.dir}/classes" overwrite="true">
        <fileset dir="${basedir}/${build.dir}/jibx/classes">
            <include name="**/*"/>
        </fileset>
    </copy>
</target>

in jibx.xml У меня есть:

    <?xml version="1.0" encoding="UTF-8"?>
<project>
    <!-- generate using default settings -->
    <target name="jibx-codegen" >
        <echo message="Running code generation from schema"/>
        <java classname="org.jibx.schema.codegen.CodeGen" fork="yes" failonerror="true">
            <arg value="--generate-all=true"/>
            <arg value="-n"/>
            <arg value="jibxmodel"/>
            <arg value="-t"/>
            <arg value="${basedir}/${build.dir}/jibx/src"/>
            <arg value="src/xmlresource/XSD_final2.xsd"/>
            <classpath path="${javac.classpath}"/>
        </java>
        <move toDir="${src.dir}" overwrite="true">
            <fileset dir="${basedir}/${build.dir}/jibx/src">
                <include name="**/*.java"/>
            </fileset>
        </move>
        <move toDir="${src.dir}/xmlresource/" overwrite="true">
            <fileset dir="${basedir}/${build.dir}/jibx/src">
                <include name="**/*.xml"/>
                <include name="**/binding.xml"/>
            </fileset>
        </move>
    </target>

  <!-- bind as a separate step -->
    <target name="jibx-bind" depends="jibx-compile">
        <echo message="Running JiBX binding compiler : ${basedir}/${build.dir}/classes"/>
        <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
            <classpath path="${javac.classpath}"/>
        </taskdef>
        <bind binding="${basedir}/src/xmlresource/binding.xml">
            <classpathset dir="${basedir}/${build.dir}/jibx/classes"/>
        </bind>
        <copy toDir="${basedir}/${build.dir}/classes" overwrite="true">
            <fileset dir="${basedir}/${build.dir}/jibx/classes">
                <include name="**/*"/>
            </fileset>
        </copy>
    </target>

  <!-- compile the classes -->
    <!--target name="jibx-compile" depends="jibx-codegen"-->
    <target name="jibx-compile">   
        <echo message="Compiling JiBX Java source code"/>
        <mkdir dir="${basedir}/${build.dir}/jibx/classes"/>
        <javac srcdir="${basedir}/${src.dir}/jibxmodel" destdir="${basedir}/${build.dir}/jibx/classes" debug="on" source="1.5">
            <classpath path="${javac.classpath}/classes"/>
        </javac>
    </target>

    <target name="jibx-postcompile" depends="jibx-bind">
        <copy toDir="${basedir}/${build.dir}/classes" overwrite="true">
            <fileset dir="${basedir}/${build.dir}/jibx/classes">
                <include name="**/*"/>
            </fileset>
        </copy>
    </target>
</project>

Скомпилированные Jibx файлы идут в $ {build.dir} / jibx / classes В упаковке jibx не работает. Что мне нужно изменить в скрипте муравья? Любая помощь приветствуется.

...