如何使我的构建文件依赖于首先运行的另一个构建文件?

时间:2014-09-09 22:49:06

标签: java ant

我有一个构建文件,它依赖于另一个项目中的jar文件。但是,有一个总体构建文件用于一次构建所有项目,我不能保证在我之前构建另一个项目(在这种情况下我的项目将失败)。我想知道是否有办法确保在调用我的without having to use Ivy之前建立另一个项目(看到其他主题)。

现在我的ant脚本中有一个目标,我在我依赖的项目的构建文件上调用ant任务,并且工作正常(或者至少看起来像是)< / p>

布局如下:

  <target name="buildDependencies">
        <ant antfile="../some_project/build.xml" target="build" inheritAll="false" dir="../some_project"/>
        <ant antfile="../someOtherProjectIDependOn/build.xml" target="build" inheritAll="false" dir="../someOtherProjectIDependOn"/>
    </target>

  <target name="build" depends="buildDependencies">
  //other projects are guaranteed to be built so go ahead and build this project's stuff
  </target>

但我想知道这是否有点危险,或者它是否会导致该总体构建文件(调用所有项目构建)基本上在buildDependencies中构建项目两次。

我希望有一种更清洁的方法。

0 个答案:

没有答案