2011-04-13 25 views
2

我目前使用的是標準Ant,我想轉移到Ant4Eclipse(http://www.ant4eclipse.org/)以利用我的eclipse項目已經擁有的類路徑信息來構建它並運行單元試驗。Ant4Eclipse示例

我發現的問題是我無法找到一個使用ant4eclipse構建簡單項目的好例子。我一直在搜索結果中看到混合結果,並查看了ant4eclipse文檔。任何人都有一個很好的參考ant文件使用ant4eclipse來構建一個Eclipse的Java項目,或一個網站看?

謝謝!

回答

2

所以我想我只是誤解了一些任務的命名。我導入了a4e-jdt-macros.xml(隨附ant4eclipse),並使用了「buildJdtProject」宏 - 超級簡單易用。

下面是一個例子:

<project name="ant-in-eclipse" basedir="." 
    xmlns:ant4eclipse="antlib:org.ant4eclipse" 
    xmlns:antcontrib="antlib:net.sf.antcontrib"> 
    <import file="a4e-jdt-macros.xml"/> 
    <target name="compileAndJar"> 
    <buildJdtProject workspacedirectory="${workspace.dir}" 
        projectname="${proj.name}"> 
     <finish> 
     <jar destfile="${jar.dir}/myjar.jar"> 
      <ant4eclipse:jdtProjectFileSet 
       workspacedirectory="${workspace.dir}" 
       projectname="${buildJdtProject.project.name}"/> 
     </jar> 
     </finish> 
    </buildJdtProject> 
    </target> 
</project>