我是新來的使用ANT,並試圖使用Eclipse 3.5在構建中包含第三方jar。我在編輯中不斷髮現「找不到符號」的錯誤,顯然它沒有考慮到這兩個罐子。如果任何人都可以告訴我我要出錯的地方,或者建議另一條路線,我將不勝感激。包含第三方Jars ANT
下面的JarPath是Eclipse工作區中我的項目的路徑。它在路徑中嘗試了'/'和'\',都不重要。
<?xml version="1.0" ?>
<project default="main">
<property name="env.JAVA_HOME" location="C:\Program Files\Java\jdk\bin\javac.exe"/>
<property name="jars.dir" location="JarPath"/>
<target name="main" depends="compile, compress" description="Main target">
<echo>
Building the .jar file.
</echo>
</target>
<target name="compile" description="Compilation target">
<javac srcdir="." fork="yes" executable="${env.JAVA_HOME}"/>
<classpath>
<pathelement location="${jars.dir}/A.jar"/>
<pathelement location="${jars.dir}/B.jar"/>
</classpath>
</target>
<target name="compress" description="Compression target">
<jar jarfile="MyJar.jar" basedir="." includes="*.class" />
</target>
</project>
非常感謝。一個問題是,如果你注意到我的classpath標記不在javac標記中。一旦我將它移到那裏,它就會編譯。它也使用你的方法編譯。 – Ken 2009-08-14 18:08:29