Skip to main content

zc.buildout recipe for building ant (java) projects

Project description

What is collective.recipe.ant ?

Collective.recipie.ant executes an ant build. It assumes java, and and ant is installed on the system.

Supported options:

ant

Specify the location of the ant application. This option is optional. If not used the application is looked up in the default path.

ant-home

If ant is not located in your default PATH -environment variable you can specify the location here.

ant-options

Specify the options ant should be called with. You may change the buildfile with the -buildfile option for example.

classpath

Give some extra location for including java libraries. I.e. junit, …

You can debug the ant output by increasing the verbosity of buildout.

Simple example

>>> import os.path

In the simplest form we can download a simple package and have it extracted in the parts directory.

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

Ok, let’s run the buildout:

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

This one failed. We didn’t specify any options. Let’s do that.

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

Fetch the output of the ant process, when being extra verbose

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

Let’s see if the classpath verification works

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

Now we try to reference a (hopefully) nonexisting directory

>>> 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)
While:
  Installing.
  Getting section javaproject.
  Initializing part javaproject.
Error: Classpath .../__bogus__dir__ does not exist.
<BLANKLINE>

Changelog

0.1 (2008-01-20)

  • Initial release.

Contributors

Kai Lautaportti (dokai), Author - kai.lautaportti@hexagonit.fi

Tom Gross - tom@toms-projekte.de

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.recipe.ant-0.1dev-r57216.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file collective.recipe.ant-0.1dev-r57216.tar.gz.

File metadata

File hashes

Hashes for collective.recipe.ant-0.1dev-r57216.tar.gz
Algorithm Hash digest
SHA256 c143c21a53011b31ea90d88e2b2a247a28f43ce1aafd997556b3984c316d9ad9
MD5 940a42aa82e7805a55b5bc339d6f6102
BLAKE2b-256 d824297c8885da543b1e810a27f3a491a9e4cd44ab3df46aac890c65720cbb09

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page