nextMock is integrated into Maven 2.

Maven is a build tool where each project use a pom.xml file to configure the build process.

Here is an extract of a pom.xml file of a project using nextmock.

...
<build>
        <plugins>
                ...
                <plugin>
                        <groupId>nextmock</groupId>
                        <artifactId>nextmock-maven</artifactId>
                        <version>0.2</version>
                        <executions>
                                <execution>
                                        <goals><goal>generate</goal></goals>
                                </execution>
                        </executions>
                </plugin>
                ...
        </plugins>
</build>

<dependencies>
        <dependency>
                <groupId>nextmock</groupId>
                <artefctId>nextmock-runtime</artefactId>
                <version>0.2</version>
                <scope>test</scope>
        </dependency>
</dependencies>

The plug-in is automatically bound to the generate-test-sources phase of the lifecycle.

When executed, it look for all .nextmock property file into the test source directories. Those files contains the list of all classes for which mock object must be generated.

The classes to mock are searched in the test classpath of the project.

The nextMock mojo generates the mock sources in a directory configurable with the outputDirectory parameter. By default, it is target/generated-sources/nextmock. The directory is added to the test source directories.