私はthis Ant guideに従おうとしており、log4jの外部ライブラリを追加しようとしているセクションでエラーが発生しています。ガイドの指示に従って、私は適切なthis log4j jarをダウンロードし、それを私のlibライブラリに入れました。私はlibフォルダにjarファイルを直接展開してみました。Antは外部ライブラリを検出できませんか?
エラーは、私が既に必要なライブラリをインポートし、Antを指すのは私のbuild.xmlにありますが、それを見つけることができません。ここで
error: package org.apache.log4j does not exist ...
error: could not find symbol BasicConfigurator.configure(); ...
^
はかなりコピーである私のbuild.xmlファイル、であり、例えば(マイナス "oata" パッケージ名から貼り付け:
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="HelloWorld"/>
<property name="lib.dir" value="lib"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}" classpathref="classpath">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
これが動作するかどうかを確認してください。http://stackoverflow.com/a/22284104/2549021 – AKS