Index cucumber for Java annotations for efficient runtime discovery
Java Groovy
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Cucumber for Java Annotation Indexer

Cucumber for Java requires that you specify the packages in which your step definitions exist. At runtime, cucumber uses some hack to try to list all the classes in this package, loads them one by one, and finds those that have step definition annotations like @When and @Then. This is both poor user experience (Can't you just find my step definitions!?) and poor performance.

This library offers a much better alternative. It uses annotation indexer to create an index of step definitions and hooks at compile time. Thanks to JSR-269, this happens automatically on Java6 and later. With the index in /META-INF/annotations, runtime can load all the step definitions quite efficiently.

This library contains BetterJavaBackend implementation, which replaces sthe standard JavaBackend.

Put this jar in your dependency instead of cucumber-java, and Cucumber should find this backend automatically.