-
Notifications
You must be signed in to change notification settings - Fork 72
Ant
Running Cuke4Duke with Ant is relatively easy. You do not need a full install of JRuby to use cuke4duke with Ant. Since Cuke4Duke depends on several jar files with particular versions, we recommend you use Apache Ivy to manage these jar files. Ivy is entirely optional though.
The first you need to do is to install the Ivy jar file into Ant’s lib dir. Depending on your platform:
- OS X:
/usr/share/ant/lib
- Windows:
[where_you_unzipped_ant]\lib
Once you have installed Ivy in your Ant installation you must set up three files:
- ivy.xml
- ivysettings.xml
- build.xml
A minimal example of all of these files has been set up in Cuke4Duke’s Java example. Here you will also see Cuke4Duke’s built-in<gem>
and <cucumber>
Ant tasks in action. These tasks support all of the same attributes and elements as Ant’s java task, so if you need to set e.g. JVM arguments, just look at that documentation.
The <gem>
task supports the following special attributes:
-
args
: pass command line arguments to thegem
command – separated by space.
The <cucumber>
task supports the following special attributes:
-
args
: pass command line arguments to thegem
command – separated by space. -
objectFactory
: “pico”, “spring” or “guice” (shorthand for setting the object factory with a JVM argument).
Compiling all the code and running Cucumber is done with a single command:
ant -Divy=true -Dgems=true
(The two Java system properties can be ommitted for subsequent runs as you don’t need to download jars and gems for each run).
This should place all needed jar files under lib
and all needed ruby gems under lib/.jruby
. You don’t have to install JRuby or any gems separately. We recommend you use a similar scripted approach for your own project. That way everybody on the team can get exactly the same Cucumber setup with a single command.
Now that you have local JRuby installation underneath your lib directory you can use the Command Line interface if you want, using lib/.jruby/bin/cuke4duke
.