有没有更好的方法从跨平台的 ant 构建生成第二个 ant 构建?
这是我与 Windows 一起使用的内容,
<target name="forknewant">
<property name="ant.dir" value="${basedir}/apache-ant-1.8.2" />
<exec executable="cmd" dir="${project.loc}">
<arg value="/K" />
<arg value="start" />
<arg value=""${project.title}"" />
<arg line="cmd.exe /k ant" />
<arg value="-Dtest.haltonfailure=no" />
<env key="CLASSPATH" value="" />
<env key="ANT_HOME" value="${ant.dir}" />
<env key="PATH" value="${ant.dir}/bin;${java.home}/bin" />
</exec>
</target>
此代码的要求是分叉一个新的构建,父构建不会等待并显示控制台输出。
我知道这适用于 Windows,但我正在寻找跨平台的方法。
Here is what I have that work with windows
<target name="forknewant">
<property name="ant.dir" value="${basedir}/apache-ant-1.8.2" />
<exec executable="cmd" dir="${project.loc}">
<arg value="/K" />
<arg value="start" />
<arg value=""${project.title}"" />
<arg line="cmd.exe /k ant" />
<arg value="-Dtest.haltonfailure=no" />
<env key="CLASSPATH" value="" />
<env key="ANT_HOME" value="${ant.dir}" />
<env key="PATH" value="${ant.dir}/bin;${java.home}/bin" />
</exec>
</target>
Requirement for this code is to fork a new build, parent build doesn't wait and console output is displayed.
I know this work for windows but I am looking for cross platform way of doing it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也许可以通过
ant 实现您想要的目标 任务,从一个 Ant 脚本运行另一个脚本。像这样的事情:
但是,父构建文件将等待此任务完成后再继续。
您可以考虑使用
并行
任务来运行多个事物并行。这可能会解决您的问题,具体取决于您想要做什么。请务必阅读并行文档中有关并发的警告。parallel
将等待它运行的所有任务完成。但是,您可以使用daemons
标记来避免这种情况。因此,最接近您要求的是:这将在
${project.loc}
中运行 Ant 构建文件,而不是等待它完成。然而,有一个重要的警告:如果主构建文件首先完成,它将终止生成的构建进程。parallel
文档对此进行了全部解释。You might be able to achieve what you want with the
ant
task which runs one Ant script from another. Something like this:However, the parent build file will wait for this task to complete before it proceeds.
You can consider using the
parallel
task to run several things in parallel. Depending on exactly what it is you want to do, this might solve your problem. Be sure to read the warnings about concurrency in the documentation forparallel
.parallel
will wait until all tasks it runs are completed. However, you can use thedaemons
tag to avoid that. So the closest thing to what you ask for would be:This wil run the Ant build file in
${project.loc}
, not waiting for it to finish. There is one important caveat however: if the main build file finishes first, it will kill the process of the spawned build. This is all explained in theparallel
doc.