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.
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?
Thanks!
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.
Here's an example:
<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>
精彩评论