我對使用ant有點新,目前,我製作ant腳本的方式是通過eclipse自動生成它們以生成可運行jar。問題在於它只能讀取bin目錄。因此,如果我要更改一個java src文件,我不會看到在ant build中複製的更改。我需要添加到我的螞蟻腳本?我下面所示的一個示例腳本:使用ant編譯java代碼
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project poodah">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="../lib/TestMaster.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="test.startup.TestMaster"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="../test/bin"/>
</jar>
</target>
</project>
我嘗試閱讀一些文件,但它是一個有點混亂。
你需要知道,Eclipse會自動編譯改變的源代碼(/src)並將其放入/ bin;它甚至會將其他(非Java)文件從/ src複製到/ bin。這樣/ bin文件夾總是最新的。只要您在Eclipse中進行更改即可。看起來你已經試圖在Eclipse之外做一些改變。在這種情況下,您需要像以下建議的那樣擁有獨立的build.xml。 – Cebence