java - 如何复制ant运行后创建的文件

标签 java eclipse ant eclipse-plugin

我的 Ant 代码

<?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>

这不起作用,因为我明白了

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

pde.exportPlugins 部分是由 eclipse 自动生成的,它运行后台进程,使用插件创建 jar。

我想将该插件复制到我使用的 3 个 eclpse 实例中,并将其放入 dropins 文件夹中。 怎么做?

最佳答案

要在构建完成后完成工作,您可以使用构建监听器。
Kev Jackson 在他的演示文稿中实现了一个非常有用的执行监听器 =
http://people.apache.org/~kevj/ossummit/extending-ant.html (来源包含在演示文稿中)。
对于每个构建结果( BUILD SUCCESSFUL | BUILD FAILED ),它提供了一个任务容器 您可以将所有内容放入应在构建完成后运行的内容:

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

关于java - 如何复制ant运行后创建的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15261977/

相关文章:

xml - 如果和除非在 Ant 中

eclipse - 如何使用 eclipse 在 testng 中设置 sysproperty?

java - 当其中一个目标使用 java ant 并将 fork 设置为 true 时,如何结束构建过程

java - 正则表达式组 java

java - “发布到本地主机上的 tomcat v7.0 服务器...”遇到错误

java - 从同一程序调用 cassandra 和 elastic search 时出现异常

java.lang.ClassNotFoundException : org. springframework.web.context.ContextLoadListener

java - 如何处理从未使用过分配对象的情况

Java Swing GridBagLayout : JLabel takes up too much space

java - 如何在Java中的不同对象之间进行等待和通知?