问题
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