构建蚂蚁(Java)项目的ZC构建方案

collective.recipe.ant的Python项目详细描述


What is collective.recipe.ant ?

collective.recipie.ant执行蚂蚁构建。它假设java和ant 安装在系统上。

支持的选项:

蚂蚁
指定ant应用程序的位置。此选项是可选的。 如果未使用,则在默认路径中查找应用程序。
蚂蚁回家
如果ant不在默认的PATH-环境变量中 您可以在此处指定位置。
蚂蚁选项
指定应使用的选项ant。你可以改变 例如,使用-buildfile选项生成文件。
类路径
为包含java库提供一些额外的位置。 即junit,…

可以通过增加buildout的详细程度来调试ant输出。

Simple example

>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = javaproject
...
... [javaproject]
... recipe = collective.recipe.ant
... """)

好,让我们运行构建:

>>> print system(buildout)
Installing javaproject.
Build failed
While:
  Installing javaproject.
Error: System error: Buildfile: build.xml does not exist!
<BLANKLINE>
<BLANKLINE>

这次失败了。我们没有指定任何选项。让我们这样做吧。

>>> from os.path import join, dirname
>>> buildfile = join(dirname(__file__), 'testdata', 'echo.xml')
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = javaproject
...
... [javaproject]
... recipe = collective.recipe.ant
... ant-options =
...     echo
...     -buildfile %s
...
... """ % buildfile)

获取Ant进程的输出,当它非常详细时

>>> print system(buildout + ' -v')
Installing ...
<BLANKLINE>
echo:
     [echo] Foo Bar
<BLANKLINE>
BUILD SUCCESSFUL
Total time: 0 seconds
<BLANKLINE>
javaproject: Build successful
<BLANKLINE>

让我们看看类路径验证是否有效

>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = javaproject
...
... [javaproject]
... recipe = collective.recipe.ant
... classpath = %s %s
... ant-options =
...     echo
...     -buildfile %s
...
... """ % (join(dirname(__file__), 'testdata'),
...        tmpdir('foo'),
...        buildfile))
>>> print system(buildout)
Uninstalling javaproject.
Installing javaproject.
javaproject: Build successful
<BLANKLINE>

现在我们尝试引用一个(希望)不存在的目录

>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = javaproject
...
... [javaproject]
... recipe = collective.recipe.ant
... classpath = %s
... ant-options =
...     echo
...     -buildfile %s
...
... """ % (join(dirname(__file__), '__bogus__dir__'),
...        buildfile))
>>> print system(buildout)
Uninstalling javaproject.
Installing javaproject.
While:
  Installing javaproject.
Error: Classpath .../__bogus__dir__ does not exist.
<BLANKLINE>

1.0 (2010-01-05)

  • Initial Release [tom_gross]
  • Removed path checks from __init__() since the required paths may not be available at that time. [dokai]

Contributors

kai lautaportti(dokai),作者-kai.lautaportti@hexagonit.fi

汤姆格罗斯-itconsense@gmail.com

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JavaBridge errno=10054被Remotehost关闭   javafx如何在每次调用方法中的变量时更新它?(爪哇)   java mod_群集在发现后未平衡负载   Java软件编辑器/语法高亮   java为什么不能强制转换数组的结果。asList()到ArrayList?   java HIBERNATE:无法使用HIBERNATE从MySQL中提取数据   java在Google地图片段上添加布局   java在AbstractTableModel中执行setValueAt之前,我如何做一些事情?   java在整个Tomcat运行时保存变量   java如何在Thymeleaf模板中获取环境变量的值?   java Selenium Chrome驱动程序针对属性的标签   java正则表达式捕获未知数量的重复组