我目前正在使用标准Ant,我想转移到Ant4Eclipse(http://www.ant4eclipse.org/),以利用我的eclipse项目已经拥有的类路径信息来构建它并运行单元测试。
我发现的问题是我找不到使用ant4eclipse构建一个简单项目的好例子。我一直在通过搜索和查看ant4eclipse文档获得喜忧参半的结果。任何人都有一个很好的参考ant文件,使用ant4eclipse构建一个Eclipse java项目,或者一个要查看的站点?
谢谢!
答案 0 :(得分: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>