Ant4Eclipse Examples

百般思念 提交于 2019-12-11 03:52:43

问题


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!


回答1:


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>


来源:https://stackoverflow.com/questions/5649348/ant4eclipse-examples

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!