Ant4Eclipse 示例 [英] Ant4Eclipse Examples
问题描述
我目前正在使用标准 Ant,我想转移到 Ant4Eclipse (http://www.ant4eclipse.org/) 以利用我的 eclipse 项目已经拥有的类路径信息来构建它并运行单元测试.
I'm currently using standard Ant and I want to move to Ant4Eclipse (http://www.ant4eclipse.org/) to take advantage of the classpath information that my eclipse project already has to build it and run unit tests.
我发现的问题是我找不到使用 ant4eclipse 构建简单项目的好例子.通过搜索和查看 ant4eclipse 文档,我得到了不同的结果.有没有人有使用ant4eclipse构建Eclipse java项目的好参考ant文件,或者有网站可以看看?
Problem i'm finding is I can't find a good example of using ant4eclipse to build a simple project. I've been getting mixed results going through searches and looking at the ant4eclipse documentation. Anyone have a good reference ant file using ant4eclipse to build an Eclipse java project, or a site to look at?
谢谢!
推荐答案
所以我想我只是误解了一些任务的命名.我导入了 a4e-jdt-macros.xml(ant4eclipse 自带),并使用了buildJdtProject"宏 - 超级好用.
So I think I just misunderstood some of the naming of the tasks. I imported the a4e-jdt-macros.xml (comes with ant4eclipse), and used the "buildJdtProject" macro - super easy to use.
这是一个例子:
<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>
这篇关于Ant4Eclipse 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!