zc.buildout为构建ant(java)项目提供的配方
项目描述
什么是collective.recipe.ant ?
Collective.recipie.ant执行ant构建。它假定Java,并且ant已安装在系统上。
支持选项
- ant
指定ant应用程序的位置。此选项是可选的。如果没有使用,应用程序将在默认路径中查找。
- ant-home
如果ant不在您的默认PATH环境变量中,您可以在此处指定位置。
- ant-options
指定ant应使用的选项。例如,您可以使用-buildfile选项更改构建文件。
- classpath
提供一些额外的位置以包含Java库。例如,junit等。
您可以通过增加buildout的详细程度来调试ant输出。
简单示例
>>> write(sample_buildout, 'buildout.cfg', ... """ ... [buildout] ... parts = javaproject ... ... [javaproject] ... recipe = collective.recipe.ant ... """)
好的,让我们运行buildout
>>> 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)
首次发布 [tom_gross]
从 __init__() 中移除了路径检查,因为所需的路径可能在该时间不可用。[dokai]
贡献者
Kai Lautaportti (dokai),作者 - kai.lautaportti@hexagonit.fi
Tom Gross - itconsense@gmail.com
下载
项目详情
关闭
collective.recipe.ant-1.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 711e62cb5993f347bb44cf58be97444a65b2dab7843d6c2de572a974cc64f026 |
|
MD5 | 8781d51e45e95d49f5e4dfe29c3cc9d4 |
|
BLAKE2b-256 | c796321d9e87020fa3d3e33ef013ca4348c7cd6d32bedd6290ab8c01179d070d |