0
のための参照エラー例外:私はjarファイルがダウンロードされていることがわかりAntが、私は私のbuild.xmlファイルにタスクを追加する既存のJARファイル
<target name="forbidden-checks" depends="download-forbidden-checks">
<taskdef name="forbidden-apis" classname="de.thetaphi.forbiddenapis.AntTask"
classpathref="lib/forbiddenapis-2.2.jar"/>
<fa:forbiddenapis classpathref="build.classpath" dir="${build.dir}" targetVersion="${jdk.version}">
<bundledsignatures name="jdk-unsafe"/>
<bundledsignatures name="jdk-deprecated"/>
<bundledsignatures name="jdk-non-portable"/>
</fa:forbiddenapis>
</target>
を、問題はありません。しかし、私はエラーが発生します:
download-forbidden-checks:
setup-maven-url:
download-via-maven:
[get] Getting: https://repo1.maven.org/maven2/de/thetaphi/forbiddenapis/2.2/forbiddenapis-2.2.jar
[get] To: /home/kamaci/pro/lib/forbiddenapis-2.2.jar
forbidden-checks:
BUILD FAILED
/home/kamaci/pro/build.xml:2391: Reference /home/kamaci/pro/lib/forbiddenapis-2.2.jar not found.
私はjarファイルのパスに問題があるかどうかを確認しました。ですから、私はforbiddenapis-2.2.jarをプロジェクト以外の場所に配置しました。私はその樽を私のタスケーフから指摘しましたが、同じエラーがあります。
アイデア?
EDIT 1:
私はそれにそれを変更しました:
<target name="forbidden-checks" depends="download-forbidden-checks">
<taskdef name="forbidden-apis" classname="de.thetaphi.forbiddenapis.AntTask">
<classpath>
<pathelement location="/home/kamaci/pro/forbiddenapis-2.2.jar"/>
</classpath>
</taskdef>
<fa:forbiddenapis targetVersion="${jdk.version}">
<classpath>
<pathelement location="lib/forbiddenapis-2.2.jar"/>
</classpath>
<bundledsignatures name="jdk-unsafe"/>
<bundledsignatures name="jdk-deprecated"/>
<bundledsignatures name="jdk-non-portable"/>
</fa:forbiddenapis>
</target>
しかし、それは動作しませんでした:
Problem: failed to create task or type antlib:de.thetaphi.forbiddenapis:forbiddenapis
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-/usr/share/ant/lib
-/home/kamaci/.ant/lib
-a directory added on the command line with the -lib argument
を私はこれを実行すると:
をant forbidden-checks -lib lib/
が動作します。マイプロジェクト定義は、build.xmlの時とで始まる:
なぜ私は-libを追加する必要がありますか?それを避ける方法はありますか?
私の編集を確認できますか? – kamaci