2012-05-08 1 views
1

ここに情報を追加してください。蟻でコンパイルすると、多くのクラスエラーが表示されないのはなぜですか?

Buildfile: D:\Users\Rajesh\workspace\Jib\src\build.xml 
check-runtime: 
codegen: 
    [echo] Running code generation from schema 
    [mkdir] Created dir: D:\Users\Rajesh\workspace\Jib\src\gen 
    [java] Loaded and validated 1 specified schema(s) 
    [java] Generated 5 top-level classes in package org.jibx.starter 
    [java] Total classes in model: 5 
compile: 
    [echo] Compiling Java source code 
    [mkdir] Created dir: D:\Users\Rajesh\workspace\Jib\src\bin 
    [javac] D:\Users\Rajesh\workspace\Jib\src\build.xml:114: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
    [javac] Compiling 5 source files to D:\Users\Rajesh\workspace\Jib\src\bin 
    [javac] D:\Users\Rajesh\workspace\Jib\src\build.xml:117: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
    [javac] Compiling 1 source file to D:\Users\Rajesh\workspace\Jib\src\bin 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:33: error: cannot find symbol 
    [javac]    IBindingFactory bfact = BindingDirectory.getFactory(Order.class); 
    [javac]                ^
    [javac] symbol: class Order 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:36: error: cannot find symbol 
    [javac]    Order order = (Order)uctx.unmarshalDocument(in, null); 
    [javac]   ^
    [javac] symbol: class Order 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:36: error: cannot find symbol 
    [javac]    Order order = (Order)uctx.unmarshalDocument(in, null); 
    [javac]       ^
    [javac] symbol: class Order 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:40: error: cannot find symbol 
    [javac]    for (Iterator<Item> iter = order.getItemList().iterator(); iter.hasNext();) { 
    [javac]       ^
    [javac] symbol: class Item 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:41: error: cannot find symbol 
    [javac]     Item item = iter.next(); 
    [javac]    ^
    [javac] symbol: class Item 
    [javac] location: class Test 
    [javac] 5 errors 

BUILD FAILED 
D:\Users\Rajesh\workspace\Jib\src\build.xml:117: Compile failed; see the compiler error output for details. 

Total time: 3 seconds 

あなたはそれが他のクラスを認識カント見ることができるように:私は

<?xml version="1.0"?> 


<project basedir="." default="full"> 

    <property name="jibx-home" value="C:/Jibx"/> 


<!-- make sure required jars are present --> 
    <condition property="runtime-jars-found"> 
    <available file="${jibx-home}/lib/jibx-run.jar"/> 
    </condition> 
    <condition property="binding-jars-found"> 
    <and> 
     <available file="${jibx-home}/lib/bcel.jar"/> 
     <available file="${jibx-home}/lib/jibx-bind.jar"/> 
     <available file="${jibx-home}/lib/jibx-run.jar"/> 
    </and> 
    </condition> 
    <available property="extras-jar-found" file="${jibx-home}/lib/jibx-extras.jar"/> 

    <!-- set classpath for compiling and running application with JiBX --> 
    <path id="classpath"> 
    <fileset dir="${jibx-home}/lib" includes="*.jar"/> 
    <pathelement location="bin"/> 
    </path> 

    <!-- make sure runtime jars are present --> 
    <target name="check-runtime"> 
    <fail unless="jibx-home">JiBX home directory not found - define JIBX_HOME system property or set path directly in build.xml file.</fail> 
    <fail unless="runtime-jars-found">Required JiBX runtime jar jibx-run.jar was not found in JiBX home lib directory (${jibx-home}/lib)</fail> 
    </target> 

    <!-- make sure extras jars are present --> 
    <target name="check-extras" depends="check-runtime"> 
    <fail unless="extras-jar-found">Required JiBX extras jar jibx-extras.jar was not found in JiBX home lib directory (${jibx-home}/lib)</fail> 
    </target> 

    <!-- make sure binding jars are present --> 
    <target name="check-binding" depends="check-runtime"> 
    <fail unless="binding-jars-found">Required JiBX binding jar jibx-bind.jar or bcel.jar was not found in JiBX home lib directory (${jibx-home}/lib)</fail> 
    </target> 

    <!-- clean compiled class files and output file --> 
    <target name="clean"> 
    <delete quiet="true" dir="bin"/> 
    <delete quiet="true" dir="gen"/> 
    </target> 

    <!-- generate as a separate step --> 
    <target name="codegen" depends="check-runtime"> 

    <echo message="Running code generation from schema"/> 
    <delete quiet="true" dir="gen"/> 
    <mkdir dir="gen"/> 
    <java classname="org.jibx.schema.codegen.CodeGen" fork="yes" 
     classpathref="classpath" failonerror="true"> 
     <arg value="-t"/> 
     <arg value="gen/src"/> 
     <arg value="-w"/> 
     <arg value="starter.xsd"/> 
    </java> 

    </target> 

    <!-- generate using customizations as a separate step --> 
    <target name="custgen" depends="check-runtime"> 

    <echo message="Running code generation from schema"/> 
    <delete quiet="true" dir="gen"/> 
    <mkdir dir="gen"/> 
    <java classname="org.jibx.schema.codegen.CodeGen" fork="yes" 
     classpathref="classpath" failonerror="true"> 
     <arg value="-c"/> 
     <arg value="custom.xml"/> 
     <arg value="-t"/> 
     <arg value="gen/src"/> 
     <arg value="-w"/> 
     <arg value="starter.xsd"/> 
    </java> 

    </target> 

    <!-- compile the classes --> 
    <target name="compile" depends="check-runtime"> 

    <echo message="Compiling Java source code"/> 
    <mkdir dir="bin"/> 
    <javac srcdir="gen/src" destdir="bin" debug="on"> 
     <classpath refid="classpath"/> 
    </javac> 
    <javac srcdir="src" destdir="bin" debug="on"> 
     <classpath refid="classpath"/> 
    </javac> 

    </target> 

    <!-- bind as a separate step --> 
    <target name="bind" depends="check-binding"> 

    <echo message="Running JiBX binding compiler"/> 
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask"> 
     <classpath> 
     <fileset dir="${jibx-home}/lib" includes="*.jar"/> 
     </classpath> 
    </taskdef> 
    <bind binding="gen/src/binding.xml"> 
     <classpath refid="classpath"/> 
    </bind> 
    </target> 

    <!-- run the included test program to read and then write to separate file --> 
    <target name="run" depends="check-runtime"> 
    <echo message="Running the sample application..."/> 
    <java classname="org.jibx.starter.Test" fork="true" failonerror="true"> 
     <classpath refid="classpath" /> 
     <arg value="starter.xml"/> 
     <arg value="out.xml"/> 
    </java> 
    <echo message="Generated output document out.xml"/> 
    </target> 

    <target name="full" depends="codegen,compile,bind,run"/> 
    <target name="custom" depends="custgen,compile,bind,run"/> 

    <!-- show list of targets --> 
    <target name="help"> 
    <echo message="Targets are:"/> 
    <echo/> 
    <echo message="clean   delete all class files and generated code"/> 
    <echo message="compile  compile class files"/> 
    <echo message="codegen  generate code using defaults"/> 
    <echo message="bind   compile JiBX bindings"/> 
    <echo message="run   run test program"/> 
    <echo message="full   full build and run using defaults"/> 
    <echo message="custgen  generate code using customizations"/> 
    <echo message="custom  full build and run using customizations"/> 
    </target> 

</project> 

私が手に出力されているとなっているAntビルドfile.Theコードを持っています。何故ですか ?メインで参照される他のクラスを認識させるために私がここでできることは何ですか?これらの欠落したクラスはorg.jibx.starterパッケージで生成されます

+0

を使用する方法を学ぶ?私はあなたがあなたのアプリケーションをコンパイルする必要があることを確認の.classファイル –

+1

を見つけることができないと思いますか?実行はコンパイルに依存しないので、コンパイルのためにターゲットを追加し、その上で実行をdependeする必要があります。 – maress

+1

プログラムをコンパイルし、ランタイムクラスパスからクラスファイルにアクセスできるようにしてください。 jarファイルに存在するクラスファイルの場合、jarファイルが実行時クラスパスに存在することを確認してください。 – jay

答えて

0

ANTのJavaタスクは.classファイルを必要とするJavaコマンドと同じです。

まず、javaをコンパイルし、適切なフォルダに配置して正常に実行します。

がどのようにウルメインクラスをコンパイルしている javac task in ANT

+1

質問をより明確にしていただきますようお願い申し上げます。 – Rajeshwar

+0

build.xmlなしで実行し、必要なフォルダに.classファイルをチェックします。 –