How to copy files created after ant run

旧城冷巷雨未停 提交于 2020-01-07 05:02:09

问题


My Ant code

<?xml version="1.0" encoding="UTF-8"?>
<project default="plugin_export" name="build">
  <target name="plugin_export">
    <pde.exportPlugins destination="C:\" exportSource="false" exportType="directory" plugins="MyPlugin" useJARFormat="true" allowbinarycycles="true" filename="MyPlugin.jar" qualifier="X" />
    <waitfor maxwait="15" maxwaitunit="minute">
      <copy todir="j:\eclipse-rcp-juno-SR1-win32\dropins\">
        <fileset dir="c:\plugins\">
          <include name="*" />
        </fileset>
      </copy>
    </waitfor>
  </target>
</project>

it doesn't work, because I get

windows_build.xml:8: waitfor doesn't support the nested "copy" element.

pde.exportPlugins part is auto-generated by eclipse and it runs background process that creates jar with a plugin.

I would like to copy that plugin into 3 instances of eclpse I do use and put it in the dropins folder. How to do it ?


回答1:


To get things done after your build has finished, you may use a buildlistener.
Kev Jackson implemented a very useful exec-listener in his presentation =
http://people.apache.org/~kevj/ossummit/extending-ant.html (sources are included in the presentation).
For each build result ( BUILD SUCCESSFUL | BUILD FAILED ) it provides a taskcontainer you can put all your stuff in that should run AFTER Build has finished :

<exec-listener onSuccess="true">
    <echo>Executing after BUILD SUCCESSFUL...</echo>
    <exec executable="..">
      <arg value="..."/>
    </exec>
    <mail ... />
   ..other tasks
  </exec-listener>
<exec-listener onSuccess="false">
    <echo>Executing after BUILD FAILED...</echo>
    <exec executable="..">
      <arg value="..."/>
    </exec>
    <mail ... />
   ..other tasks
  </exec-listener>


来源:https://stackoverflow.com/questions/15261977/how-to-copy-files-created-after-ant-run

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