Running a PyAMF WSGI server in Apache Ant using Jython

Apache Ant is a Java-based build tool. Ant build files are created using XML but it also support Python scripts using Jython.

There are 2 ways to execute Python scripts in Ant:

JSR-223 enables dynamic languages to be callable via Java in a seamless manner. Unfortunately this is currently only supported with Jython 2.2.1 and not the latest 2.5.0. Since PyAMF only supports Jython 2.5 or newer, you have to use the PythonInterpreter class directly. This style of embedding code is very similar to making use of a scripting engine, but it has the advantage of working with Jython 2.5.

Here you see the gateway running in Ant:

Buildfile: build.xml clean: compile: [mkdir] Created dir: build/classes [javac] Compiling 1 source file to build/classes jar: [mkdir] Created dir: build/jar [jar] Building jar: build/jar/HelloWorld.jar run: [java] *sys-package-mgr*: processing new jar, 'build/jar/HelloWorld.jar' [java] Running AMF gateway on http://localhost:8000

Read the complete howto, including a sample server/client, on