JBehave was developed as behaviour-driven and example-driven. Read more about the examples modules and examples philosophy.

Getting the source code

Examples are not released as artifacts so the source code is needed to run them. The source code can be checked out from source repository or can be found as one of artifacts of the jbehave-distribution (the "src" zip bundle).

Running Examples with latest snapshot

To build core modules and run examples with Maven:

The use of settings.xml is only required the first time you build (see building source).

The 'examples' profile instructs Maven to build the releasable modules and to verify their behaviour by running the examples afterwards.

To run the GUI example too (requires non-headless mode):

If you are running the GUI example, see the note on building source for installing all the required dependendencies.

Running Examples against a fixed version

In some cases, you may want to run the examples against a known version of JBehave.

Note that running the examples in 'standalone' mode requires the JBehave parent POM to be present, as it contains the information about the setup of the project, e.g. the compiler, the layout of the source, etc.

One option, is to pull the dependencies from the snapshots repository, activated by the sonatype profile in the settings.xml provided next to the top-level POM.

The other option is to install the parent POM from source:

As with any Maven artifact that is not expected to change, the build or retrieval is only required once, as it will be cached in the local repository. So, once you've built the JBehave parent POM from source or retrieved it from the snapshots repository, you don't need to do it again, unless you think it needs to be updated. The same goes for the Examples parent POM.